- kubectl configured to communicate with the cluster
- A two-node cluster (control plane + worker)
1) Count the nodes in the cluster
Run:controlplane and node01.
2) Check if node01 has any taints
Describe the node:Taints: <none>).
3) Add a taint to node01
Taint node01 with keyspray, value mortein, effect NoSchedule:
4) Create a pod (mosquito) and observe scheduling failure
Create the pod:
- The control plane has the built-in
node-role.kubernetes.io/master:NoScheduletaint. node01now hasspray=mortein:NoSchedule.
A taint prevents pods from being scheduled onto a node unless the pod includes a matching toleration in its pod spec. Tolerations do not grant scheduling; they only allow the scheduler to consider the node.
5) Create a pod (bee) that tolerates spray=mortein:NoSchedule
You cannot add a toleration via the simple kubectl run flags, so generate a base YAML and edit it:

bee.yaml so it tolerates spray=mortein:NoSchedule:
bee is scheduled to node01 because it tolerates the spray=mortein:NoSchedule taint. mosquito remains Pending.
6) Inspect control plane taints and remove the master taint
Check taints on the control plane:Removing the control plane/master taint may result in workloads running on control plane components. Only untaint control plane nodes if you intend to schedule workloads there (e.g., in single-node or small test clusters).
- to delete the taint):
7) Verify pods are scheduled
mosquito runs on controlplane (because the master taint was removed), and bee stays on node01 (because it tolerates the spray=mortein:NoSchedule taint).
Quick reference: common taint/toleration commands
Summary
- Taints repel pods from nodes unless pods include matching tolerations.
- Tolerations are specified in the pod spec (YAML) and must match the taint key/value/effect (depending on operator) to allow scheduling.
- Use
kubectl taintto add and remove taints; append a trailing-to remove a taint. - Be cautious when removing control plane taints — running workloads on control plane nodes is typically not recommended for production clusters.
- Kubernetes: Taints and Tolerations — https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/