Feature Overview
Component Description
DNSAutoscaler is an add-on for DNS horizontal auto scaling. It obtains the number of nodes and cores of a cluster through a Deployment and then automatically scales the number of DNS replicas according to preset scaling policies. Currently, two scaling modes are supported: Linear mode and Ladder mode.
Linear Mode
Sample ConfigMap configuration is as follows:
data:linear: |-{"coresPerReplica": 2,"nodesPerReplica": 1,"min": 1,"max": 100,"preventSinglePointFailure": true}
Target replica calculation formula:
replicas = max( ceil( cores × 1/coresPerReplica ), ceil( nodes × 1/nodesPerReplica ) )
replicas = min(replicas, max)
replicas = max(replicas, min)
Ladder Mode
Sample ConfigMap configuration is as follows:
data:ladder: |-{"coresToReplicas":[[ 1, 1 ],[ 64, 3 ],[ 512, 5 ],[ 1024, 7 ],[ 2048, 10 ],[ 4096, 15 ]],"nodesToReplicas":[[ 1, 1 ],[ 2, 2 ]]}
Calculating the quantity of target replicas:
Assume that the above configuration is applied in a cluster with 100 nodes and 400 cores, then: nodesToReplicas = 2 (100>2), coresToReplicas = 3 (64<400<512), the greater value of the two is 3, so replica = 3.
Kubernetes objects deployed within a cluster
Kubernetes Object Name | Local Disk Types | Requested Resource | Namespace |
tke-dns-autoscaler | Deployment | Per node: 20M CPU and 10Mi memory | kube-system |
dns-autoscaler | ConfigMap | - | kube-system |
tke-dns-autoscale | ServiceAccount | - | kube-system |
tke-dns-autoscaler | ClusterRole | - | kube-system |
tke-dns-autoscaler | ClusterRoleBinding | - | kube-system |
Limits
The add-on supports only clusters with Kubernetes version 1.8 and later.
The workload of the DNS server in the cluster should be Deployment or CoreDNS.
Note
During CoreDNS horizontal scaling, some CoreDNS replicas may be unavailable for a period of time. We recommend that you optimize related configurations to maximize the DNS service availability. For more information, see Configuring Smooth Upgrade.
How to Use
1. Log in to the TKE console and select Cluster in the left sidebar.
2. On the Cluster management page, click the ID of the target cluster to go to the cluster details page.
3. In the left menu bar, select Add-On Management. Navigate to the Add-On List page and click Create.
4. On the Create add-on page, select DNSAutoscaler. The default scaling configuration of this component is as follows:
data:ladder: |-{"coresToReplicas":[[ 1, 1 ],[ 128, 3 ],[ 512,4 ],],"nodesToReplicas":[[ 1, 1 ],[ 2, 2 ]]}
After the add-on is created successfully, you can modify its configuration by modifying
configmap/tke-dns-autoscaler under the kube-system namespace. For more information about the configuration, see the official documentation.5. Click Done to complete the process.