Melhttps://unixcop.com
Unix/Linux Guru and FOSS supporter

How to taint a node in kubernetes cluster to avoid pods scheduling on that node

Tainting a node means you don’t want any pods to be scheduled on that node by kube-scheduler. For tainting a particular node, we have to label that node first using below command

$ kubectl label nodes kube-node01 my-taint2=test2

Once node is labeled, we are ready to taint that node using below command

$ kubectl taint nodes kube-node01 my-taint2=test2:NoSchedule

To check taint status of a node, run below command and search taint field.

$ kubectl describe nodes kube-node01 

Taints filed should have status NoSchedule as shown below

Taints:             my-taint2=test2:NoSchedule

Now kube-node01 is tainted which means kube-scheduler will not schedule any pod on this node, usually this is done to avoid putting unwanted load on a single control plane master node.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

x