简体   繁体   中英

Stop scheduling pods on kubernetes master

For testing purpose, I have enabled pod scheduling on kubernetes master node with the following command

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. 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:

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

To learn more,see Taints and Tolerations

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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