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

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

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.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Mel
Melhttps://unixcop.com
Unix/Linux Guru and FOSS supporter

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook