Skip to main content
Cluster operationsLesson 1 of 16

Which Node Gets the Pod (Scheduling)

A web pod and a GPU job pod arrive in a cluster with three nodes. Let's see which nodes the scheduler rules out, which one it picks, and what happens when there is nowhere to go.

Pod to placeweb-1
Candidates left3
Result—
3 worker nodesweb podRequests 1 CPUGPU jobHas tolerationSchedulerPicks a nodenode-1CPU free 0.5node-2CPU free 3gpu-nodeTaint: gpuunscheduled
RequestWatchAppears in a later step

What you will learn

  • Free capacity is the sum of requests, not real usage
  • Taint means "keep out", node selector means "come here"
  • Why anti-affinity spreads one app across nodes
  • How to read a Pending message by cause

Placement rules at a glance​

RuleDirectionWhat it doesExample
Requests (requests)Scheduler filters nodesDrops nodes without room for the summed requestsRequests 1 CPU core → node with 0.5 free is excluded
Taints · tolerationsNode filters podsAccepts only pods that tolerate the markKeep regular pods off GPU nodes
Node selector · node affinityPod chooses nodesGoes only to nodes with matching labelsOnly nodes with gpu: "true"
Pod anti-affinityPod avoids other podsPuts replicas of the same app on different nodesOne web replica per node

Try it yourself​

kubectl describe pod <pod> # Events: 0/3 nodes are available: ...
kubectl describe node <node> | grep -A 8 'Allocated resources' # Sum of requests, not usage
kubectl get nodes -o custom-columns=NAME:.metadata.name,TAINTS:.spec.taints # Node taints
kubectl get nodes --show-labels # Labels a nodeSelector matches
kubectl get pods -o wide # Which node each replica landed on

Check yourself

  1. A node's CPU usage graph shows 20%, yet a Pod requesting 1 CPU will not be placed there. Why?
  2. The GPU job has a toleration for the gpu taint but no nodeSelector. Where can it land?
  3. web-2 is Pending with 0/3 nodes are available, including 1 node(s) didn't match pod anti-affinity rules. Replicas outnumber nodes. What fixes the anti-affinity part?

Further reading: Kubernetes Scheduler · Assigning Pods to Nodes · Taints and Tolerations