Advanced Scheduling in Kubernetes

Node & Pod Affinity/Anti-Affinity, Taints and Tolerations

Scheduler is a Kubernetes controller listening if a new pod is created and figure out right node by filtering and scoring

Node Affinity/Anti-Affinity

Node Affinity

Pod Anti-Affinity

TopologyKey — it looks for the hostname, if it matches it doesn’t schedule (since we mentioned podAntiAffinity) that pod to that node.

Taints and Tolerations

Taints Example

Update the evicted pods as in above image

Taint NoSchedule is set on Master node so that pods are not deployed on master node