coredns容器仅在一个主机上运行

时间:2019-05-20 23:43:32

标签: kubernetes

我设置了具有3个主机的Kubernetes HA集群。版本1.14.2。观察到2个coredns容器仅在一个主机上运行。如果我停止该主服务器,则coredns将停止。是否有任何配置可以将其生成给其余的主服务器?

如何将coredns容器生成给其余的主服务器。

1 个答案:

答案 0 :(得分:0)

您需要部署dns自动缩放器。然后调整自动缩放参数。 跟随链接 https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/

按照步骤

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