Autoscaling CoreDNS
CoreDNS is the default DNS service for Kubernetes that runs in Pods with the label k8s-app=kube-dns
. In this lab exercise we'll scale CoreDNS based on the number of schedulable nodes and cores of our cluster. Cluster Proportional Autoscaler will resize the number of CoreDNS replicas.
Amazon EKS offers the ability to automatically scale CoreDNS via the EKS addon, which is the recommended path for production use. The material covered in this lab is for educational purposes.
First lets install CPA using its Helm chart. We'll use the following values.yaml
file to configure CPA:
options:
target: deployment/coredns
namespace: kube-system
config:
linear:
nodesPerReplica: 2
min: 2
max: 6
preventSinglePointFailure: true
includeUnschedulableNodes: true
Target the deployment coredns
Add a replica for every 2 worker nodes in the cluster
Always run at least 2 replicas
Do not scale to more than 6 replicas
The configuration above should not be considered best practice for automatically scaling CoreDNS, it is an example that is easy to demonstrate for the purposes of the workshop.
Install the chart:
NAME: cluster-proportional-autoscaler
LAST DEPLOYED: [...]
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
This will create a Deployment
in the kube-system
namespace which we can inspect:
NAME READY UP-TO-DATE AVAILABLE AGE
cluster-proportional-autoscaler 1/1 1 1 92s