How the scheduler places Pods

Advanced · 13 min

Inside kube-scheduler: the queue, filter and score plugins, binding, reading FailedScheduling messages, scheduling gates, and running other schedulers.

Before thisThe control planeRequests, limits and QoS classes

Kubesimplify · 13 min

How the scheduler places Pods

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by KubesimplifyReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • The scheduler watches for Pods with no nodeName, takes them one at a time from a priority queue, and binds each to a node by writing a Binding. It never starts anything. The kubelet does.
  • Each cycle runs filter plugins to drop nodes that can't run the Pod, then score plugins to rank the rest. The highest weighted score wins, with random tie-breaks.
  • A FailedScheduling event lists, per reason, how many nodes each filter rejected, plus why preemption couldn't help. It's the first thing to read for a Pending Pod.
  • Default scoring prefers the least-allocated node by requests and spreads a workload's Pods across nodes and zones, so placement follows requests, not live usage.
  • schedulingGates hold a Pod out of the queue until a controller removes them. A Pod with nodeName set, or a schedulerName no scheduler serves, skips the default scheduler entirely.

One decision, made constantly

Every Pod has to land somewhere. In a busy cluster that’s thousands of decisions an hour, each with dozens of constraints: enough CPU and memory, the right zone for its disk, no forbidden taints, spread away from its siblings, near or far from other Pods. A human doing it would be a bottleneck. The control plane lesson introduced kube-scheduler as the component that does it. This lesson opens it up.

The scheduler’s whole output is one field. It watches for Pods whose spec.nodeName is empty, picks a node, and writes a Binding that sets it. The kubelet on that node sees a Pod assigned to it and starts the containers. In our lab, where no kubelet exists, Pods get a NODE and then sit Pending forever, which is a clean view of the scheduler’s job with nothing after it.

The queue

Unscheduled Pods go into a priority queue (the PrioritySort plugin orders it by Pod priority, then age). Pods that failed wait in a backoff queue (1 s growing to 10 s by default) or in an unschedulable pool until a cluster event, such as a new node or a deleted Pod, could make them fit. The scheduler’s metrics show these queues. On the lab cluster, scheduler_pending_pods reported queue="unschedulable" 11 for our stuck test Pods, alongside active, backoff and gated queues.

Filter, then score

For each Pod the scheduler runs a cycle of plugins at fixed extension points. Think of hiring: first drop every candidate who fails a hard requirement, then rank whoever’s left.

Filter plugins reject nodes that can’t run the Pod: NodeUnschedulable (cordoned nodes), NodeName, TaintToleration, NodeAffinity (selectors and required affinity), NodePorts, NodeResourcesFit (unrequested capacity), the volume plugins (zone, attach limits, binding), PodTopologySpread and InterPodAffinity (their hard rules), and DynamicResources for DRA devices.

Score plugins rate the survivors from 0 to 100, each multiplied by a weight. We dumped the v1.37.3 defaults with kube-scheduler --write-config-to: TaintToleration weight 3, NodeAffinity, PodTopologySpread, InterPodAffinity and DynamicResources weight 2, NodeResourcesFit, NodeResourcesBalancedAllocation and ImageLocality weight 1. NodeResourcesFit scores with LeastAllocated: the more of a node’s allocatable CPU and memory is still unrequested, the better. The highest total wins, and ties are broken at random.

Then reserve (claim the resources in the scheduler’s cache so the next Pod doesn’t double-book them), permit (an optional wait, used for gang scheduling), and bind, which runs asynchronously so the next Pod can start its cycle.

You can see the scoring in placement. Six identical Pods requesting 500m CPU on two 4-CPU nodes and one 2-CPU node landed three on n1, two on n2 and one on n3: least-allocated scoring keeps choosing the node with the most free requested capacity, so the small node fills up proportionally sooner. In large clusters, percentageOfNodesToScore lets the scheduler stop filtering once it has found enough feasible nodes. 0, the default, means an adaptive value based on cluster size.

Reading FailedScheduling

When no node passes, the scheduler writes an event that counts rejections per reason. From our lab, with n3 cordoned:

0/3 nodes are available: 1 node(s) were unschedulable, 2 Insufficient cpu.
preemption: 0/3 nodes are available: 1 Preemption is not helpful for scheduling, 2 No preemption victims found for incoming pod.

And for a Pod with a nodeSelector no node satisfied:

0/3 nodes are available: 1 node(s) were unschedulable, 2 node(s) didn't match Pod's node affinity/selector.

Each node is counted under the filter that rejected it. The second sentence is from the DefaultPreemption post-filter. “Not helpful” means evicting Pods couldn’t fix that node’s problem (it’s cordoned, or the selector doesn’t match). “No preemption victims” means there’s nothing lower-priority to evict. kubectl describe pod shows the same message. The preemption lesson covers when it does help.

Ways around the scheduler

nodeName set in the Pod spec skips scheduling altogether. Our pinned-1 Pod went straight to the cordoned node n3, because cordoning is a scheduler filter and nothing filtered. DaemonSets once worked like that; they now use node affinity and go through the scheduler.

schedulerName chooses which scheduler handles a Pod. Our Pod with schedulerName: my-scheduler stayed Pending with no events at all, because no scheduler served that name. You can run extra schedulers or, more often, extra profiles in one scheduler, each with its own schedulerName and plugin settings, for example a bin-packing profile using MostAllocated for batch jobs.

schedulingGates (GA since 1.30) keep a Pod out of the queue. Our gated Pod showed status SchedulingGated and wasn’t attempted. When we removed the gate with a JSON patch, it was scheduled to n1 within seconds. Controllers such as Kueue use gates to create Pods early and release them when quota allows.

Where scheduling is heading

The scheduler has always placed one Pod at a time, which fits web services and fits AI training jobs badly: eight workers that each need a GPU are useless if only seven can start. Kubernetes 1.37 moved the Workload and PodGroup APIs, gang scheduling and workload-aware preemption to beta, so a group of Pods is placed all together or not at all. The queue metrics’ incomplete and pending counts are for those groups.

About the video

The embed is Kubesimplify’s “How Does the Kubernetes Scheduler Pick a Node?”, April 2026, 13 minutes. Its chapters walk all the framework’s extension points in order, the informer and the three queues, PreFilter, Filter, PostFilter (where preemption lives), PreScore, Score with weights, ImageLocality, normalisation, Reserve and Permit, Bind and the handoff to the kubelet, then a live demo including preemption. That covers this lesson’s middle in more detail. Judged from chapters and description, since transcripts can’t be fetched here, and from its “English (US) original” audio track and English captions. The SIG Scheduling maintainers’ 2026 update in deeper covers the move to workload scheduling.

What was run: against a local v1.37.3 control plane with three fake Nodes and the real kube-scheduler, we dumped the default scheduler configuration, read the scheduler’s queue metrics, placed six Pods and saw least-allocated spreading, cordoned a node and read both FailedScheduling messages, bypassed the scheduler with nodeName, left a Pod unserved with a custom schedulerName, and released a gated Pod. No containers ran, checked 2026-11-29.

Where this fits

Filters and scores are mostly driven by what the Pod asks for. Next: node selectors and affinity.

Check yourself

  1. 01A Pod is Pending and its event says '0/3 nodes are available: 1 node(s) were unschedulable, 2 Insufficient cpu'. What does each part tell you?

    One node is cordoned (spec.unschedulable) and the other two lack enough unrequested CPU for the Pod's request. Each node is counted once under the first filter that rejected it. The preemption part says whether evicting lower-priority Pods could have helped.

  2. 02Six identical Pods land three, two and one across two 4-CPU nodes and one 2-CPU node. Which plugins produced that?

    NodeResourcesFit scoring with the LeastAllocated strategy prefers the node with the most free requested capacity, balanced allocation favours even CPU and memory use, and the default topology spread nudges Pods of a workload apart. The smaller node fills up proportionally sooner.

  3. 03A Pod with schedulerName my-scheduler has been Pending for an hour with no events at all. Why?

    No running scheduler claims that name, so no one ever tries to schedule it, and no one writes FailedScheduling events. The default scheduler only handles Pods with schedulerName default-scheduler.

  4. 04Why might a controller create Pods with a scheduling gate instead of creating them later?

    To create the whole group up front (for quota, visibility or gang scheduling) but keep them out of the scheduling queue until a condition is met, such as quota or all resources being available. Gated Pods cost the scheduler nothing; removing the gate releases them.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark