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.
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
We summarized how linear scaling works with CPA in the previous section. We can see that we're configuring it to:
- Target the deployment
coredns
- Add a replica for every 2 worker nodes in the cluster
- Run at least 2 replicas and to most 6
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