Control plane
The scheduler
Filter, score, bind
The plugins that decide where a Pod runs: resources, affinity, taints and spreading. Traffic rises, so you scale web to four - and one new Pod has to be placed. Watch the scheduler filter two feasible nodes down to one winner, and write its single-sentence verdict into the cluster.
- Decision
- one Pod, two nodes, one Binding
- Phases
- filter → score → reserve → bind
- Inputs
- requests, taints, image locality, spreading
- Run time
- ≈ 40 ms for one Pod
Read the whole lesson as text
1. The queue
You scale the Deployment to four. The ReplicaSet creates web-…-t9c3k with an empty spec.nodeName - it exists, but nothing will run it until a node's name appears in that field. The scheduler watches every Pod, and files the ones with no node into its active queue. It decides one Pod at a time, in priority order.
- You ask for a fourth web Pod.
- The scheduler's watch delivers the new Pod with no node.
2. Filter
Filter plugins answer yes or no, one node at a time. NodeResourcesFit checks the Pod's requests - 500m CPU, 256 Mi - against each node's unreserved capacity. NodeUnschedulable, taints, node affinity and node ports each get a veto. Both nodes pass every filter here, but that's information: the feasible set is {node-1, node-2}.
- Six filter plugins run per node; both nodes survive all of them.
3. Score
Scoring plugins rank what's left, 0 to 100 each, and the weighted sum picks. NodeResourcesFit prefers emptier nodes: node-2 is 41% allocated, node-1 is 62%. PodTopologySpread, which counts double, prefers node-1, which runs fewer web Pods. ImageLocality is a draw, because both nodes already have web:1.4.2. Add it up and node-2 wins by a hair, 337 to 332: its emptiness just outweighs the spreading.
- The scoring plugins disagree; the weighted totals settle it.
4. Bind
The scheduler reserves node-2 for a few milliseconds while Permit plugins run, then does the only thing it can do: POST a Binding. That single object update sets spec.nodeName on the Pod. The scheduler never talks to node-2, never starts anything, tells no kubelet. It writes one field and moves to the next Pod in the queue.
- The verdict is written as a Binding: node-2.
- node-2's kubelet sees the assignment on its own watch - nobody notified it directly.
5. When nothing fits
If every node is filtered out, the scheduler doesn't error - it writes a condition and stops. The Pod sits Pending with PodScheduled=False, and the scheduler retries gently forever, because a filtered-out node can free up at any moment: a DaemonSet finishes, a Pod is deleted, a cordoned node is uncordoned. One exception escalates: a Pod with a high PriorityClass may preempt - evict lower-priority Pods until it fits.
- On a full cluster, the same loop ends here instead: Pending, with the reason recorded.
Summary
Filter to the possible, score to the preferable, bind by writing spec.nodeName. The scheduler's entire authority is that one field - every kubelet watches for its own name there. Its judgment lives in plugins whose weights you can tilt: requests and limits, taints and tolerations, affinities and spreading constraints.
Next lesson: Reconcile loops