Taint Effects: NoSchedule, PreferNoSchedule, NoExecute
You'll learn the three taint effects in Kubernetes and how each controls pod scheduling and eviction differently.
Understanding Taint Effects
When you apply a taint to a node, you must specify one of three effects that determine how strictly the taint is enforced. Think of these as three levels of "keep out" signs: one absolutely blocks entry, one discourages entry, and one not only blocks entry but evicts current occupants.
The Three Effects
NoSchedule is the strictest scheduling rule. Pods without a matching toleration will never be scheduled on this node. However, pods already running on the node before the taint was applied remain undisturbed.
PreferNoSchedule is a soft version of NoSchedule. The scheduler will try to avoid placing pods on this node, but if no other suitable nodes exist, it will schedule the pod anyway. This is useful when you prefer certain workloads elsewhere but don't want to risk pods staying unscheduled.
NoExecute is the most aggressive effect. Not only does it prevent new pods from scheduling, but it also evicts existing pods that don't tolerate the taint. Pods with a matching toleration can specify a tolerationSeconds value to remain temporarily before eviction. This effect is commonly used for node maintenance or draining.
Use Case Comparison
- Use
NoSchedulefor dedicated nodes (GPU nodes, special hardware) - Use
PreferNoSchedulefor soft preferences (cost optimization, resource balancing) - Use
NoExecutefor node maintenance, failures, or immediate evacuation scenarios
Key Takeaway: NoSchedule blocks scheduling, PreferNoSchedule discourages it, and NoExecute both blocks scheduling and evicts running pods—choose the effect that matches your enforcement needs.