Taints and tolerations

A taint marks a node so that Pods do not run on it unless they tolerate the taint.

A taint marks a node so that Pods do not run on it unless they tolerate the taint. Taints and tolerations work together: a taint repels Pods from a node, and a toleration allows a Pod to be scheduled on a node with a matching taint. A tolerance allows scheduling but does not require it. To attract a Pod to specific nodes, use node labels with a node selector or node affinity.

In Cloudera Cloud Factory, you can add node labels and taints when you create a cluster, and a Kubernetes profile can supply them so that you do not enter them for each cluster. Use taints to keep general workloads off nodes that are reserved for special purposes.

A taint has a key, an optional value, and an effect. The effect defines what happens to Pods that do not tolerate the taint.

Table 1. Taint effects
EffectBehavior
NoScheduleThe scheduler does not place new Pods on the node. Running Pods stay.
PreferNoScheduleThe scheduler tries to avoid the node but does not guarantee it.
NoExecuteThe scheduler does not place new Pods on the node, and Pods that do not tolerate the taint are evicted.

Key defaults and limits

  • The default toleration operator is Equal. Use Exists to match a key with any value.
  • Kubernetes automatically adds tolerations for the not-ready and unreachable node conditions, with a tolerationSeconds value of 300.
  • The control plane adds built-in taints, such as node.kubernetes.io/not-ready and node.kubernetes.io/unschedulable, for node conditions.
  • DaemonSet Pods automatically tolerate several of the built-in taints, so that node-level agents keep running.

For more information, see Taints and Tolerations.