A taint is a key-value pair with an effect that is applied to a node in a Kubernetes cluster. Think of taints as a way of marking nodes with specific properties that repel certain pods. Taints tell the Kubernetes scheduler, "Don't place pods on this node unless they specifically say they can tolerate this condition."
A taint has three components:
Key: A label that identifies what property is being tainted (e.g., dedicated
, gpu
)
Value: An optional value assigned to that key (e.g., special-workload
, true
)
Effect: Defines how pods that don't tolerate this taint will be treated
Taint Effects
There are three possible effects when applying a taint:
NoSchedule: This is the strictest regular effect. Pods will not be scheduled on the node unless they have a matching toleration. However, existing pods already running on the node will continue to run.
PreferNoSchedule: This is a "soft" version of NoSchedule. The scheduler will try to avoid placing pods that don't tolerate the taint on the node, but it's not a guarantee. If no better option exists, pods may still be scheduled there.
NoExecute: This is the most aggressive effect. Not only will new pods without matching tolerations not be scheduled on the node, but existing pods without matching tolerations will be evicted (terminated and rescheduled elsewhere).