Skip to content
StackDecode
IntermediateLesson 19 of 35

Scheduling: selectors, affinity, taints

Control which nodes pods land on.

  • nodeSelector: simple label match.
  • Node affinity: expressive rules, required or preferred.
  • Pod affinity/anti-affinity: co-locate or spread pods (spread replicas across zones).
  • Taints repel pods from a node; tolerations let specific pods in.
  • Topology spread constraints: even distribution across zones or nodes.
yaml
nodeSelector: { disktype: ssd }
tolerations:
  - key: 'gpu'
    operator: 'Equal'
    value: 'true'
    effect: 'NoSchedule'
bash
kubectl taint nodes node1 gpu=true:NoSchedule