Kubernetes Pod Scheduling

Kubernetes pod scheduling determines how the control plane assigns pods to nodes using a multi-phase pipeline of filtering, scoring, and binding decisions. Mastering scheduling lets you control placement for availability, performance, cost, and fault isolation across your cluster.

Overview

Overview

Pod scheduling is how the control plane decides which node runs each new pod. The default kube-scheduler watches for unscheduled pods and runs each through a pipeline of filter and score plugins before committing a node. Knowing that pipeline is the key to clusters that stay available across zones, avoid resource contention and scale well.

Each pod takes the same path through that pipeline.

  • The unscheduled pod waits in the scheduling queue.
  • Filter drops every node that cannot fit the pod.
  • Score ranks the nodes that survive.
  • Reserve and Permit hold the chosen node and approve the decision.
  • Bind writes the node's name into the pod's nodeName field.

If no node fits at step 2, the pod goes to PostFilter instead, where preemption may evict lower-priority pods to make room.

Key concepts

  • Scheduler Extension Points and the Scheduling Framework
  • Node Affinity: Required vs Preferred
  • Pod Affinity and Anti-Affinity with topologyKey
  • Topology Spread Constraints
  • Taints and Tolerations
  • QoS Classes and Eviction Order
  • PriorityClass and Preemption

Interview questions

  • How would you configure a deployment to spread 10 replicas evenly across 3 availability zones, ensuring no zone has more than 1 pod extra compared to any other zone?
  • What is the difference between pod anti-affinity and topology spread constraints for distributing pods, and when should you prefer one over the other?
  • Walk through the order in which the kubelet evicts pods during a node memory pressure event. What determines where each pod falls in the eviction order?
  • Explain the mechanics of pod preemption. What happens step by step when a high-priority pod cannot be scheduled on any node?
  • Your cluster autoscaler is not scaling up even though several pods have been pending for 10 minutes due to insufficient CPU. What are the likely root causes and how do you diagnose each one?

Sign up free to read the full topic

More DevOps topics

Start free on Cariara · Coding problems · System design studio