Toleration
A toleration is a pod setting that lets the scheduler place the pod on a node with a matching taint. It permits scheduling on restricted nodes but does not attract the pod there.
What a toleration does
A taint repels pods, and a toleration is the pod's declaration that it is allowed on the restricted node. It must match the taint's key, value, and effect, or use the Exists operator to match any value.
no toleration"] -.->|"repelled"| N["Node gpu-node-1
workload=gpu:NoSchedule"] P2["GPU pod
tolerates workload=gpu"] ==>|"allowed"| N classDef pod fill:#DBEAFE,color:#1E293B classDef node fill:#FFEDD5,color:#1E293B class P1,P2 pod class N node
Example
spec: tolerations: - key: "workload" operator: "Equal" value: "gpu" effect: "NoSchedule" containers: - name: encoder image: registry.example.com/video-encoder:v3.1.0 resources: limits: nvidia.com/gpu: 1The matching node taint:
kubectl taint nodes gpu-node-1 workload=gpu:NoScheduleOperators
- Equal (default) requires key and value to match.
- Exists matches on the key alone.
- An
Existstoleration with no key matches every taint, so keep it to system DaemonSets.
tolerationSeconds
For NoExecute taints, tolerationSeconds sets how long a pod may remain before eviction. Kubernetes gives pods a default of 300 seconds for the not-ready and unreachable taints, which you can shorten for faster failover.
tolerations: - key: "node.kubernetes.io/unreachable" operator: "Exists" effect: "NoExecute" tolerationSeconds: 60Troubleshooting
| Problem | Symptom | Fix |
|---|---|---|
| Pod Pending | untolerated taint message | Add matching toleration |
| Still Pending | Effect or value mismatch | Match exactly |
| Lands on other nodes | Toleration does not pin the pod | Add nodeSelector or affinity |
Common MistakeUsing
operator: Existswith no key. It tolerates every taint and defeats isolation for that pod.
TipPair every toleration for dedicated nodes with node affinity so pods go only where intended.
Frequently Asked Questions
How do tolerations interact with taints?
The scheduler considers a tainted node only if the pod tolerates every taint on it, matching key, value, and effect. A toleration allows the placement but does not choose the node.
Is a toleration permanent?
For NoExecute taints, tolerationSeconds sets a limit after which the pod is evicted anyway. This is how default failover timing is controlled.
Why do DaemonSet pods land on tainted nodes automatically?
Kubernetes adds default tolerations to DaemonSet pods for common node conditions, and many agents add broader tolerations so they run everywhere.