Process Flow - Taints and tolerations
Add Taint to Node
Pod Scheduled?
Pod Allowed
This flow shows how a node with a taint affects pod scheduling. Pods must have matching tolerations to be allowed on tainted nodes.
kubectl taint nodes node1 key=value:NoSchedule kubectl apply -f pod.yaml # pod.yaml has tolerations for key=value kubectl get pods kubectl describe pod pod1
| Step | Action | Node State | Pod Tolerations | Scheduling Result | Notes |
|---|---|---|---|---|---|
| 1 | Add taint key=value:NoSchedule to node1 | node1 tainted with key=value:NoSchedule | N/A | N/A | Node now rejects pods without matching toleration |
| 2 | Apply pod1 with toleration key=value:NoSchedule | node1 tainted | tolerates key=value:NoSchedule | Pod scheduled | Pod allowed on tainted node due to toleration |
| 3 | Apply pod2 without tolerations | node1 tainted | no tolerations | Pod pending | Pod rejected by scheduler due to taint |
| 4 | Describe pod1 | node1 tainted | tolerates key=value:NoSchedule | Running | Pod is running on tainted node |
| 5 | Describe pod2 | node1 tainted | no tolerations | Pending | Pod waiting for suitable node |
| 6 | Remove taint from node1 | node1 no taints | N/A | N/A | Node accepts all pods now |
| 7 | Pod2 scheduled after taint removal | node1 no taints | no tolerations | Pod scheduled | Pod2 now runs on node |
| Variable | Start | After Step 1 | After Step 2 | After Step 3 | After Step 6 | Final |
|---|---|---|---|---|---|---|
| node1_taints | none | key=value:NoSchedule | key=value:NoSchedule | key=value:NoSchedule | none | none |
| pod1_tolerations | none | none | key=value:NoSchedule | key=value:NoSchedule | key=value:NoSchedule | key=value:NoSchedule |
| pod2_tolerations | none | none | none | none | none | none |
| pod1_status | N/A | N/A | Scheduled | Scheduled | Scheduled | Running |
| pod2_status | N/A | N/A | Pending | Pending | Scheduled | Running |
Taints mark nodes to repel pods. Pods must have matching tolerations to run on tainted nodes. Taint format: key=value:effect (e.g., NoSchedule). Tolerations in pod spec allow ignoring taints. Without toleration, pods stay pending on tainted nodes. Removing taint allows all pods to schedule.
taint in Kubernetes?node1 that repels pods without the matching toleration?kubectl taint nodes followed by node name and taint details.kubectl taint nodes for taints = A [OK]key=value:NoSchedule?
tolerations: - key: "key" operator: "Equal" value: "value" effect: "NoSchedule"
key=value:NoSchedule to a node, but pods without tolerations are still scheduling on it. What is the most likely cause?Pass the test and this pattern moves unknown