设置master调度_去除master污点

转载自:https://www.modb.pro/db/424007

===============

 

使用kubeadm初始化的集群,默认情况下,出于安全考虑Pod不会被调度到Master Node上,不参与工作负载。在某些资源有限的情况下,需要允许master节点部署pod,可以设置去除Master节点污点,使Master节点可以承担工作负载。

 

1. 查看所有节点taint状态

当前共2个节点,一个master,一个node

[root@rh-node01 ~]# kubectl describe nodes | grep -E '(Roles|Taints)'
Roles:              control-plane
Taints:             node-role.kubernetes.io/control-plane:NoSchedule
Roles:              <none>
Taints:             <none>

 

2. 去除所有节点的master Taint状态

 使所有master01均可被调度

[root@node01 ~]# kubectl taint nodes --all node-role.kubernetes.io/master-
taint "node-role.kubernetes.io/master" not found
taint "node-role.kubernetes.io/master" not found
当前提示,表示master已无Traint设置。

 

3. 查看master01的Traint状态

 none表示当前已无Traint设置

[root@node01 ~]# kubectl describe nodes master01 |grep Taint
Taints:             <none>

 

4. 验证

 创建pod验证,应当前只有两个节点,故生成2副本的http pod

[root@node01 ~]# kubectl create deployment --image=nginx --replicas=2 http
deployment.apps/http created

如果节点数量较多,可提高replicas数量,不低于节点数量,如20节点的集群,--replicas=20,这样明显看到pod分布。

注:如果想只起两个副本且必须分配到两个机器上  请参考nodeSelector以及亲和性和反亲和性的的用法。

[root@node01 ~]# kubectl get pods -o wide        #会发现此时master节点上已经分配了一个Pod
NAME                    READY   STATUS    RESTARTS   AGE   IP           NODE              NOMINATED NODE   READINESS GATES
http-7d57549bfd-hwkdh   1/1     Running   0          66s   10.244.1.2   node01.cbg.cn     <none>           <none>
http-7d57549bfd-v9bj7   1/1     Running   0          66s   10.244.0.4   master01.cbg.cn   <none>           <none>

 

5. 参考

http://t.zoukankan.com/xlovepython-p-14468772.html
https://blog.csdn.net/weixin_41303815/article/details/109202136

 

posted @   larybird  阅读(326)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示
点击右上角即可分享
微信分享提示