Pcornel
Containers · Scheduling, Resources & Health

Taints, Tolerations and Affinity

Cheat sheet · https://pcornel.dk/topic.php?topic=6155

Back to the Topic

Answer

Taints repel pods from nodes unless pods tolerate them; node affinity and nodeSelector attract pods to nodes; pod (anti-)affinity places pods relative to other pods.

Remember

Pending with "node(s) had untolerated taint" or "didn't match node affinity" in events. Prefer soft (preferred) rules unless placement is mandatory.

First checks

  • kubectl describe node | grep Taints — first check for this topic
  • kubectl get pods -o wide — pods, status, node, IP
  • kubectl describe pod <pod> — events and conditions
  • kubectl logs <pod> [-c <c>] [--previous] — container logs (incl. previous crash)
  • kubectl get events --sort-by=.lastTimestamp — recent cluster events

Verify in this order

pod rules + node taints/labels → scheduler filters → placement

Where it usually breaks

Required anti-affinity with more replicas than nodes leaves Pods Pending.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6155

Confirmation

Confirm action

Continue?