Scheduler internals
Follow the scheduler from eligible nodes to a selected node and a successful binding.
What you will understand
- Trace a Pod through scheduling queue, filters, scores, and binding.
- Distinguish an unsatisfied hard requirement from losing to a higher scoring node.
- Identify the events or status that show progress past scheduling.
Builds on: Topology and resource governance, Informers, caches, and workqueues
How Kubernetes compares nodes
A Pod needs a node with a training label and enough CPU. Of three candidate nodes, one lacks the label, one has no room, and one meets both requirements. The scheduler watches for Pods without an assigned node and selects nodes for them. Its filter phase removes nodes that cannot satisfy hard requirements. Its score phase ranks the feasible candidates based on preferences and configured plugins. A high score cannot make up for a failed filter.
Change the candidates in the scene. A node can pass the required rules even if it ranks below another. An event saying no node is available means you should look at feasibility before adjusting scoring preferences. A scheduler may try a later placement after new Pods finish, labels change, or other conditions improve.
Which nodes reach the scoring phase?
Hard requirements remove infeasible nodes. Configured scoring plugins rank the nodes that remain.
Read required constraints
- Pending PodFilter pluginsscheduling attempt
The Pod requires a particular node label and requests CPU and memory.
Filter infeasible nodes
- Filter pluginsNode Areject mismatch
- Filter pluginsNode Bfeasible
Node A lacks the required label; Node B satisfies hard constraints and remains feasible.
Score the candidates
- Node BScore pluginscandidate
Preferences rank Node B among feasible nodes. A rejected node cannot win through a high score.
Two nodes and one label rule isolate the ordering; actual scheduler profiles include additional plugins.
Explore another case
What happens after the scheduler chooses a node
After selecting a node, the scheduler must record the binding. In the scheduling framework, plugins can participate in stages such as reserving resources, waiting for permission to bind, and recording the association. If a later stage fails, the scheduler can undo reservations and retry. Once the binding is stored, the node’s kubelet still needs to fetch the image, prepare networking and storage, and start the containers. Inspect spec.nodeName and the PodScheduled condition before diagnosing why a container has not run yet.
What happens after the scheduler picks a node?
Binding is a separate stage. A successful binding gives the kubelet responsibility for startup on that node.
- SchedulerReserve provisional resourcesSelected nodeThe scheduler can track the intended placement before binding completes.
- Scheduling frameworkRun the remaining checksBind stepVolume and placement prerequisites can finish before the binding is recorded.
- SchedulerRecord the bindingAPI serverThe assigned kubelet then prepares the Pod and starts containers.
Binding is a separate stage. A successful binding gives the kubelet responsibility for startup on that node.
Plugin extension points are grouped; scheduling and binding work may overlap for different Pods.
Explore another case
Reproduce a failed placement
Save the example as placement.yaml and check node labels first. The Pod requires training.kv.example/accelerator=present. Apply it in your lab without that label and inspect the resulting event and condition. Its small CPU and memory requests leave the label as the intended failure. Delete the test Pod, remove the selector from the file, and apply again. Compare the condition and the assigned node. That retry is also part of the controller and scheduling lab.
apiVersion: v1
kind: Pod
metadata:
name: m15-placement
namespace: kv-lab
labels:
lab: m15
spec:
nodeSelector:
training.kv.example/accelerator: present # Hard feasibility rule.
containers:
- name: app
image: busybox:1.37.0
command: [sleep, "3600"]
resources:
requests:
cpu: 10m
memory: 16Mikubectl --context kind-kv-lab -n kv-lab apply -f placement.yaml
kubectl --context kind-kv-lab -n kv-lab describe pod m15-placement
kubectl --context kind-kv-lab -n kv-lab get pod m15-placement -o jsonpath='{.status.conditions}{"\n"}'
# Remove only the intentionally impossible selector to retry placement.
kubectl --context kind-kv-lab -n kv-lab delete pod m15-placementCheck labels and requested devices separately
A node label is useful for choosing a class of machines. It does not tell the scheduler how many devices are free. If a real Pod needs a GPU, it generally requests an advertised resource from the device integration as well as any desired node selection. More nodes without a required label, storage topology, or device can leave the same Pod pending.
Check your understanding
The Pod has PodScheduled=True but is still Pending. Should you remove its placement constraints?
It already has an assignment. Check its container and volume states and the kubelet’s events. Image pulls, volume attachment, and networking can keep startup waiting after scheduling succeeded.
Go to the source
Reviewed 2026-10-27 · Kubernetes 1.37 · Related local exercise