kubernetes - coredns 容器仅在一个主服务器上运行
问题描述
我已经设置了具有 3 个主节点的 Kubernetes HA 集群。版本 1.14.2。观察到 2 个 coredns 容器仅在一个 master 上运行。如果我停止这个 Master,coredns 就会停止。是否有任何配置可以将其生成给剩余的主人?
我怎样才能将 coredns 容器生成给剩余的主人。
解决方案
您需要部署 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
推荐阅读
- javascript - 在自定义 Modal 组件内渲染时,Material UI Tooltip 不会出现
- python - 如何导入“balanced_batch_generator”?
- python - 过度拟合 ANN 的问题——可能是由于 OneHotEncoder 问题
- django - RabbitMQ、Celery 和 Django - 与代理的连接丢失。尝试重新建立连接
- java - JDK16 和 Mac OS 上的 Mockito - 无法初始化插件
- javascript - html5游戏中如何防止2个玩家互相交叉
- python - 将标准输入转换为数据框
- android - Retrofit2 响应在 response.body 中成功,预期的对象列表为空
- android - BottomNavigationView.setupWithNavController 不工作
- ios - 如何在 SwiftUI 中禁用 ProgressView()?