简体   繁体   English

停止在Kubernetes Master上调度Pod

[英]Stop scheduling pods on kubernetes master

For testing purpose, I have enabled pod scheduling on kubernetes master node with the following command 为了进行测试,我使用以下命令在kubernetes主节点上启用了pod调度:

kubectl taint nodes --all node-role.kubernetes.io/master-

Now I have added worker node to the cluster and I would like to stop scheduling pods on master. 现在,我已将工作节点添加到集群中,并且我想停止在主节点上调度Pod。 How do I do that? 我怎么做?

您只需再次污染节点。

kubectl taint nodes master node-role.kubernetes.io/master=:NoSchedule

Taints and tolerations work together to ensure that pods are not scheduled onto inappropriate nodes. 污渍和容忍度共同作用,以确保未将豆荚安排在不适当的节点上。 One or more taints are applied to a node; 一个或多个污点应用于节点; this marks that the node should not accept any pods that do not tolerate the taints. 这标志着节点不应该接受任何不能容忍污点的豆荚。 Tolerations are applied to pods, and allow (but do not require) the pods to schedule onto nodes with matching taints. 公差适用于吊舱,并允许(但不要求)吊舱调度到具有匹配污点的节点上。

Even placed a taint on Master node,you can specify a toleration for a pod in the PodSpec, the pod would be able to schedule onto Master node: 即使在Master节点上放置污点,您也可以在PodSpec中为Pod指定容差,该Pod可以将其调度到Master节点上:

      tolerations:
      - key: node-role.kubernetes.io/master
        effect: NoSchedule

To learn more,see Taints and Tolerations 要了解更多信息,请参见污点和宽容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM