Skip to main content
This lab walkthrough demonstrates Kubernetes taints and tolerations with step-by-step commands and explanations. Follow each numbered step to reproduce the behaviour and understand why pods are scheduled or remain Pending when taints are present.
  1. Check how many nodes exist (including the control plane)
Run:
Summary: Answer: There are two nodes: controlplane and node01.
  1. Do any taints exist on node01?
Describe node01 to inspect taints and other conditions:
Conclusion: node01 currently has no taints.
  1. Add a taint to node01
Task: add a taint with key spray, value mortein, and effect NoSchedule on node01. Command pattern: kubectl taint nodes <node-name> key=value:Effect Example:
Confirm the taint is applied:
  1. Create a pod named mosquito (nginx) and observe scheduling
Create the pod:
Check pod status:
Describe the pod to find why it’s Pending:
Explanation: mosquito is Pending because both nodes have taints it does not tolerate:
  • controlplane has node-role.kubernetes.io/master:NoSchedule
  • node01 has spray=mortein:NoSchedule
  1. Create a pod named bee (nginx) that tolerates the spray=mortein:NoSchedule taint
kubectl run does not provide a flag to add tolerations directly. Use --dry-run=client to generate a manifest, then add the tolerations section manually. Generate the YAML manifest:
Edit bee.yaml and add the tolerations block under spec: so it matches the taint’s key, value, and effect. Example bee.yaml:
Apply the manifest:
Watch pod creation and status:
Check where bee was scheduled:
Result: bee was scheduled on node01 because it tolerates the spray=mortein:NoSchedule taint.
A screenshot of a web search results page showing Kubernetes documentation for "taints and tolerations" (search box contains the query). A blue banner at the top mentions the Dockershim removal for Kubernetes 1.24.
Toleration examples:
  1. Inspect the control plane node taint and remove it
Inspect the control plane node to confirm its taint:
Remove the taint by appending a trailing dash (-) to the taint spec:
  1. Observe that mosquito gets scheduled once the control plane taint is removed
Check pod statuses after removing the taint:
Confirm where mosquito is running:
Explanation: Initially both nodes had taints preventing mosquito from being scheduled. After adding a toleration, bee could run on node01. Once the controlplane taint (node-role.kubernetes.io/master:NoSchedule) was removed, the scheduler could place mosquito onto the control plane node. Final answer to the likely quiz question (“Which node is the mosquito pod finally placed on?”): controlplane
Taints prevent pods from being scheduled on nodes unless the pod has a matching toleration. A toleration does not “place” a pod on a node by itself; it simply allows scheduling onto nodes with the matching taint. The scheduler still selects the node according to normal scheduling rules.

Watch Video