Skip to main content

Install DTC

This topic describes installing the Dynamic Traffic Controller (DTC) on a supported Kubernetes cluster. This document assumes you have already installed ExternalDNS and configured it for your DNS provider (likely NS1). For details on
installing ExternalDNS, see ExternalDNS.

Dynamic Traffic Controller Configuration Parameters

The following parameters are used to configure the DTC as described in the DTC YAML file.

DTC Parameters with the ServiceAccount Object Schema

ParameterParameter TypeDescriptionRequired
apiVersionStringThe RBAC API version. The value must be rbac.authorization.k8s.io/v1.Mandatory
kindStringThe name of a particular object schema. The value must be ServiceAccount.Mandatory
metadataObjectThe metadata describes the parameters (names and types) and attributes that have been applied.Mandatory

DTC Metadata Parameters with the ServiceAccount Object Schema

ParameterParameter TypeDescriptionRequired
nameStringThe name of the Service Account that you define.Mandatory

DTC Parameters with the ClusterRole Object Schema

The following parameters are used to configure the Dynamic Traffic Controller (DTC) ClusterRole object as described in the DTC YAML file.

ParameterParameter TypeDescriptionRequired
apiVersionStringThe RBAC API version. The value must be rbac.authorization.k8s.io/v1.Mandatory
kindStringThe name of a particular object schema. The value must be ClusterRole.Mandatory
metadataObjectThe metadata describes the parameters (names and types) and attributes that have been applied.Mandatory
rulesObjectThis parameter holds information that describes a policy rule. It does not contain information about who the rule applies to or which namespace the rule applies to.Mandatory

DTC Metadata Parameters with the ClusterRole Object Schema

ParameterParameter TypeDescriptionRequired
nameStringThe name of the role that you define.Mandatory

DTC Rules Parameters with the ClusterRole Object Schema

ParameterParameter TypeDescriptionRequired
apiGroupsString ArrayThe name of the API group that contains the resources. If multiple API groups are specified, an action requested against one of the resources in any API group is allowed. You must not add an asterisk * to represent all API groups. An empty apiGroup represents the core API group.Mandatory
resourcesString ArrayThis contains an array of optional list of names that the rule applies to. An empty set means that all resources are allowed.Mandatory
verbsString ArrayA list of verbs that apply to all the resource types contained in this rule. * represents all verbs that apply to the resource types.Mandatory

DTC Parameters with the ClusterRoleBinding Object Schema

The following parameters are used to configure the Dynamic Traffic Controller (DTC) ClusterRoleBinding object as described in the DTC YAML file.

ParameterParameter TypeDescriptionRequired
apiVersionStringThe RBAC API version. The value must be rbac.authorization.k8s.io/v1.Mandatory
kindStringThe name of a particular object schema. The value must be ClusterRole.Mandatory
metadataObjectThe metadata describes the parameters (names and types) and attributes that have been applied.Mandatory
roleRefsObjectThis a reference to the role being granted.Mandatory
subjectsObjectThe name of the resource and schema to which the role is applied. For each namespace, the subjects must be added separately in an array.Mandatory

DTC Metadata Parameters with the ClusterRoleBinding Object Schema

ParameterParameter TypeDescriptionRequired
nameStringThe name of the role that you define.Mandatory

DTC Role Reference Parameters with the ClusterRoleBinding Object Schema

ParameterParameter TypeDescriptionRequired
apiVersionStringThe KubeSlice Controller API version. A set of resources that are exposed together, along with the version. The value must be rbac.authorization.k8s.io/v1 for Kubernetes (K8s) roles.Mandatory
kindStringThe kind of the role that is being referenced. The value must be ClusterRole for a Kubernetes (K8s) role.Mandatory
nameStringThe name of the role that you assign to the slice and namespaces onboarded onto that slice.Mandatory

DTC Subjects Parameters with the ClusterRoleBinding Object Schema

ParameterParameter TypeDescriptionRequired
kindStringThe type of the resource for which you assign the role. For example, the kind is a User, ServiceAccount, or a Group.Mandatory
nameStringThe name of the resource to which the role is applied.Mandatory
namespaceStringThe namespace that contains the resource to which the role is appliedMandatory

DTC Parameters with the Deployment Object Schema

The following parameters are used to configure the Dynamic Traffic Controller (DTC) Deployment object as described in the DTC YAML file.

ParameterParameter TypeDescriptionRequired
apiVersionStringThe RBAC API version. The value must be rbac.authorization.k8s.io/v1.Mandatory
kindStringThe name of a particular object schema. The value must be ClusterRole.Mandatory
metadataObjectThe metadata describes the parameters (names and types) and attributes that have been applied.Mandatory
specObjectThe specification of the desired state of an object.Mandatory

DTC Metadata Parameters with the Deployment Object Schema

ParameterParameter TypeDescriptionRequired
labelsObjectA key value pair to use with the matchLabels selector.Mandatorylabels
nameStringThe name of the application that you deploy.Mandatory
namespaceStringThe namespace on which you deploy the application.Mandatory

DTC Metadata Labels Parameters

ParameterParameter TypeDescriptionRequired
k8s-appStringA selector to match deployment pods to the deployment.Mandatory

DTC Spec Parameters with the Deployment Object Schema

ParameterParameter TypeDescriptionRequired
replicasStringThe number of dns-controller pods to be created.Mandatory
selectorObjectThe label which identifies DTC pods.Mandatory
templateObjectThe pod definition for the DTC deployment.Mandatory

DTC Spec Selector Parameters

ParameterParameter TypeDescriptionRequired
matchLabelsObjectSpecifies the labels to match when associating pods with a deployment.Mandatory

DTC Spec Selector Match Labels Parameters

ParameterParameter TypeDescriptionRequired
k8s-appStringThe key value selector pair for the deployment.Mandatory

DTC Spec Template Parameters

ParameterParameter TypeDescriptionRequired
metadataObjectThe metadata of the deployment such as it's name and namespace.Mandatory
specThe deployment specifications such as the number of replicas and template.ObjectMandatory

DTC Template Metadata Parameters

ParameterParameter TypeDescriptionRequired
labelsObjectA key value pair label which will be used by selectors to target the DTC deployment and pods.Mandatory
nameStringThe name of the DTC pod.Mandatory

DTC Template Metadata Labels Parameters

ParameterParameter TypeDescriptionRequired
k8s-appStringA selector tvo match deployment pods to the deployment.Mandatory

DTC Template Spec Parameters

ParameterParameter TypeDescriptionRequired
serviceAccountNameStringThe name of the service account.Mandatory
containersObjectMandatory

DTC Template Spec Container Parameters

ParameterParameter TypeDescriptionRequired
nameStringThe name of the container within the pod.Mandatory
imageStringThe latest image for the DTC.Mandatory
imagePullPolicyStringImage pull policy determines when a new image should be pulled from a Docker repository.Mandatory
resourcesObjectThis contains an array of optional list of names that the rule applies to. An empty set means that all resources are allowed.Mandatory
serviceAccountNameStringThe name of the service account.Mandatory

DTC Container Resources Parameters

ParameterParameter TypeDescriptionRequired
limitsObjectThe section contains the limit object that sets limits for CPU, memory, and pod count.Mandatory
requestsObjectThe section contains the requests object that sets scheduling requirements for CPU, memory, and pod count.Mandatory

DTC Resource Limits Parameters

ParameterParameter TypeDescriptionRequired
cpuStringThe maximum allowable CPU usage by the pod.Mandatory
memoryStringThe maximum allowable memory usage by the pod.Mandatory

DTC Resource Requests Parameters

ParameterParameter TypeDescriptionRequired
cpuStringThe minimum amount of CPU which must be available to schedule a pod on a node.Mandatory
memoryStringThe minimum amount of memory which must be available to schedule a pod on a node.Mandatory

Create a Dynamic Traffic Controller YAML File

info

The following manifest file contains default resource requests which should be sufficient for most users. Be sure to watch your resource utilization as you add services to the Dynamic Traffic Controller and make adjustments as required.

Copy the following configuration into a new descriptively named YAML file, such as gcp-dynamic-traffic-controller.yaml.

apiVersion: v1
kind: ServiceAccount
metadata:
name: dns-controller-sa
namespace: external-dns
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: dns-controller-clusterrole
namespace: external-dns
rules:
- apiGroups: ["metrics.k8s.io"]
resources: ["pods"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["services"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["extensions", "networking.k8s.io/v1"]
resources: ["ingress"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["extensions", "networking.k8s.io"]
resources: ["ingresses"]
verbs: ["get", "list", "watch", "update"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: dns-controller-clusterrolebinding
namespace: external-dns
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: dns-controller-clusterrole
subjects:
- kind: ServiceAccount
name: dns-controller-sa
namespace: external-dns
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
k8s-app: dns-controller
name: dns-controller
namespace: external-dns
spec:
replicas: 1
selector:
matchLabels:
k8s-app: dns-controller
template:
metadata:
labels:
k8s-app: dns-controller
spec:
containers:
- name: dns-controller
image: "aveshasystems/dynamic_traffic_controller:latest"
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: 35m
memory: 50Mi
limits:
cpu: 75m
memory: 100Mi
serviceAccountName: dns-controller-sa

Apply the Dynamic Traffic Controller YAML File

Use the following kubectl command to install all required components of the Dynamic Traffic Controller.

kubectl apply -f gcp-dynamic-traffic-controller.yaml -n external-dns

Expected Output:

serviceaccount/dns-controller-sa created
clusterrole.rbac.authorization.k8s.io/dns-controller-clusterrole created
clusterrolebinding.rbac.authorization.k8s.io/dns-controller-clusterrolebinding created
deployment.apps/dns-controller created

Wait a few moments to a minute, and then run the following command to verify the Dynamic Traffic Controller's pod is running without error.

kubectl get pods -n external-dns