Skip to main content

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.

flowchart TD P1["Regular pod
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

YAML
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: 1

The matching node taint:

Bash
kubectl taint nodes gpu-node-1 workload=gpu:NoSchedule

Operators

  • Equal (default) requires key and value to match.
  • Exists matches on the key alone.
  • An Exists toleration 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.

YAML
tolerations:
- key: "node.kubernetes.io/unreachable"
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 60

Troubleshooting

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 Mistake

Using operator: Exists with no key. It tolerates every taint and defeats isolation for that pod.

Tip

Pair 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.

Found a mistake, an outdated step or a broken link?