Stop scheduling pods on kubernetes master

4/1/2019

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?

-- Rockstart
kubernetes

2 Answers

4/1/2019

You simply taint the node again.

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

4/1/2019

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

-- S.J
Source: StackOverflow