coredns containers are running on only one master

5/20/2019

I have setup Kubernetes HA cluster with 3 masters. Version 1.14.2. Observed that 2 coredns containers are running on only one master. If I stop this Master, coredns is stopped. Are there any configuration to spawn this to remaining masters?

How can I spawn the coredns containers to the remaining masters.

-- MSR SW
kubernetes

1 Answer

5/21/2019

you need to deploy dns autoscaler. and then tune autoscale parameters. follow the link https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/

follow the steps

kubectl apply -f https://raw.githubusercontent.com/epasham/docker-repo/master/k8s/dns-horizontal-autoscaler.yaml

kubectl get deployment --namespace=kube-system

kubectl edit configmap dns-autoscaler --namespace=kube-system

Look for this line:
linear: '{"coresPerReplica":256,"min":1,"nodesPerReplica":16}'

updae min value to 2 as shown below
kubectl edit configmap dns-autoscaler --namespace=kube-system
linear: '{"coresPerReplica":256,"min":2,"nodesPerReplica":16}'

you should get two coredns pods listed as below

master $ kubectl get po --namespace=kube-system|grep dns
coredns-78fcdf6894-l54db          1/1       Running   0          1h
coredns-78fcdf6894-vbk6q          1/1       Running   0          1h
dns-autoscaler-6f888f5957-fwpgl   1/1       Running   0          2m
-- P Ekambaram
Source: StackOverflow