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.

Unix/Linux Guru and FOSS supporter


Please enter your comment!
Please enter your name here

Latest articles

You might also likeRELATED

How to Install and Configure VNC on Ubuntu Server 20.04

This article will show you how to set up a VNC on Ubuntu Server 20.04. Virtual Network Computing (VNC) is a graphical desktop sharing technology...

How to Export Your Servers Logs with Rsyslog in Centos 8

In this post, you will learn how to Export Your Servers Logs with Rsyslog in Centos 8 In this article, we'll walk through setting up...

How To Setup a Counter Strike: Global Offensive Server on CentOS 8

Counter-Strikes first option is a feature called "Official Matchmaking." This selects a Steam-owned server near you where you can play against players from all...