Scheduling and nodesLesson 8 of 10
- Requests, limits and quotas, not reconciled
- QoS classes and node-pressure eviction, not reconciled
- cgroups, memory pressure and the OOM killer, not reconciled
- How the scheduler places a pod, not reconciled
- Affinity, taints and tolerations, not reconciled
- Topology spread constraints, not reconciled
- Priority and preemption, not reconciled
- Nodes and the kubelet, not reconciled
- Disruptions and PodDisruptionBudgets, not reconciled
- Cluster autoscaling, not reconciled
Nodes and the kubelet
A Node object is the kubelet's report on one machine. Learn to read it, take a node out of service with cordon and drain, and predict what happens to pods when a node shuts down or disappears.
Shows the lesson one block at a time. Arrow keys step, number keys jump to a scene, and Escape returns to the page where you were.
Every pod runs on a node, and everything the control plane knows about that node comes from one agent on it. The kubelet registers the machine, reports its resources and health, starts the containers the scheduler assigns, and keeps telling the API server it is alive. This lesson reads that report, uses it to take a node out of service safely, and follows what happens when the reports stop.
Reconcile, in 7 scenes
The Node object
kubeletThe agent on every node that registers the node, runs the pods bound to it through the container runtime, and reports node and pod status to the API server.A Node object is mostly status written by the kubelet. Its parts answer different questions:
- Addresses: how to reach the machine, typically
InternalIPandHostname, plusExternalIPwhere the provider offers one. - Capacity: the machine’s total CPU, memory, ephemeral storage, huge pages and pod slots.
- Allocatable: what is left for pods after reservations. It is capacity minus
kube-reserved, minussystem-reserved, minus the kubelet’s hard eviction threshold. The scheduler compares pod requests against allocatable, never capacity. - Conditions:
Ready,MemoryPressure,DiskPressure,PIDPressureand, on some networks,NetworkUnavailable, each with a status, a reason and timestamps. - nodeInfo: kernel version, OS image, architecture, container runtime and kubelet version, as the kubelet discovered them.
kubectl describe node kx-worker
Name: kx-worker
Roles: <none>
Labels: beta.kubernetes.io/arch=amd64
beta.kubernetes.io/os=linux
kubernetes.io/arch=amd64
kubernetes.io/hostname=kx-worker
kubernetes.io/os=linux
Annotations: kubeadm.alpha.kubernetes.io/cri-socket: unix:///run/containerd/containerd.sock
node.alpha.kubernetes.io/ttl: 0
volumes.kubernetes.io/controller-managed-attach-detach: true
CreationTimestamp: Thu, 19 Nov 2026 09:00:05 +0000
Taints: <none>
Unschedulable: false
Lease:
HolderIdentity: kx-worker
AcquireTime: <unset>
RenewTime: Thu, 19 Nov 2026 09:00:50 +0000
Conditions:
Type Status LastHeartbeatTime LastTransitionTime Reason Message
---- ------ ----------------- ------------------ ------ -------
MemoryPressure False Thu, 19 Nov 2026 09:00:05 +0000 Thu, 19 Nov 2026 09:00:05 +0000 KubeletHasSufficientMemory kubelet has sufficient memory available
DiskPressure False Thu, 19 Nov 2026 09:00:05 +0000 Thu, 19 Nov 2026 09:00:05 +0000 KubeletHasNoDiskPressure kubelet has no disk pressure
PIDPressure False Thu, 19 Nov 2026 09:00:05 +0000 Thu, 19 Nov 2026 09:00:05 +0000 KubeletHasSufficientPID kubelet has sufficient PID available
Ready True Thu, 19 Nov 2026 09:00:05 +0000 Thu, 19 Nov 2026 09:00:05 +0000 KubeletReady kubelet is posting ready status
Addresses:
InternalIP: 172.18.0.3
Hostname: kx-worker
Capacity:
cpu: 4
ephemeral-storage: 61202244Ki
hugepages-1Gi: 0
hugepages-2Mi: 0
memory: 8388608Ki
pods: 110
Allocatable:
cpu: 4
ephemeral-storage: 61202244Ki
hugepages-1Gi: 0
hugepages-2Mi: 0
memory: 8388608Ki
pods: 110
System Info:
Machine ID: f3ac9b3b2d176f024a2f1530b8170f69
System UUID: ad375419-1473-b232-4351-fdc01ab1d945
Boot ID: d83cc430-3a63-3792-6843-1b49dd29e125
Kernel Version: 6.12.54-linuxkit
OS Image: Debian GNU/Linux 13 (trixie)
Operating System: linux
Architecture: amd64
Container Runtime Version: containerd://2.3.4
Kubelet Version: v1.37.0
PodCIDR: 10.244.1.0/24
PodCIDRs: 10.244.1.0/24
ProviderID: kind://docker/kx/kx-worker
Non-terminated Pods: (4 in total)
Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits Age
--------- ---- ------------ ---------- --------------- ------------- ---
default web-89c8ffd94-pggpj 0 (0%) 0 (0%) 0 (0%) 0 (0%) 20s
kube-system kindnet-jvfl5 100m (2%) 0 (0%) 50Mi (0%) 50Mi (0%) 45s
kube-system kube-proxy-4j54z 0 (0%) 0 (0%) 0 (0%) 0 (0%) 45s
kube-system metrics-server-68b7896d57-kqd86 100m (2%) 0 (0%) 200Mi (2%) 0 (0%) 50s
Allocated resources:
(Total limits may be over 100 percent, i.e., overcommitted.)
Resource Requests Limits
-------- -------- ------
cpu 200m (5%) 0 (0%)
memory 250Mi (3%) 50Mi (0%)
ephemeral-storage 0 (0%) 0 (0%)
hugepages-1Gi 0 (0%) 0 (0%)
hugepages-2Mi 0 (0%) 0 (0%)
Events: <none>Read it from the top. No taints and Unschedulable: false mean the scheduler may use the node. The Lease section is the heartbeat, covered next. All four conditions are healthy, with reasons that name the kubelet as their source. Capacity and allocatable match because the kx nodes reserve nothing; on a production node allocatable is visibly smaller, and a node that looks half empty by capacity can be full by allocatable. The bottom of the output adds up the requests of the pods on the node, which is what the scheduler sees as used.
Ready deserves a closer look because it has three values. True means the kubelet reports itself healthy. False means the kubelet is talking and reports a problem, such as a broken container runtime or network plugin. Unknown means the kubelet has not been heard from within the grace period; the control plane sets it, not the kubelet. A cordoned node shows SchedulingDisabled next to its status in kubectl get nodes, but that is not a condition: it is printed from spec.unschedulable.
The same data is available for scripts:
kubectl get node kx-worker -o jsonpath='{.status.allocatable}'
{"cpu":"4","ephemeral-storage":"61202244Ki","hugepages-1Gi":"0","hugepages-2Mi":"0","memory":"8388608Ki","pods":"110"}kubectl get nodes -o custom-columns=NAME:.metadata.name,RUNTIME:.status.nodeInfo.containerRuntimeVersion,KERNEL:.status.nodeInfo.kernelVersion,KUBELET:.status.nodeInfo.kubeletVersion
NAME RUNTIME KERNEL KUBELET kx-control-plane containerd://2.3.4 6.12.54-linuxkit v1.37.0 kx-worker containerd://2.3.4 6.12.54-linuxkit v1.37.0 kx-worker2 containerd://2.3.4 6.12.54-linuxkit v1.37.0 kx-worker3 containerd://2.3.4 6.12.54-linuxkit v1.37.0
Heartbeats
The kubelet proves it is alive in two ways, on different clocks.
LeaseA smallcoordination.k8s.io object. Each node has one in the kube-node-lease namespace, and the kubelet renews it as a heartbeat.
- The kubelet renews its node’s Lease every 10 seconds by default, retrying with backoff from 200 milliseconds to 7 seconds if a renewal fails. A Lease is tiny, so frequent renewals stay cheap even in large clusters.
- The kubelet updates the Node’s
.statuswhen something changes, or at least every 5 minutes. Status updates carry the full conditions and resources and are far too heavy to send every few seconds.
On the control plane, the node lifecycle controller in kube-controller-manager checks every node every 5 seconds. If neither heartbeat has arrived within node-monitor-grace-period, it sets the node’s conditions to Unknown and adds the taint node.kubernetes.io/unreachable with both NoSchedule and NoExecute effects. A node whose kubelet reports Ready=False gets node.kubernetes.io/not-ready instead. The grace period defaults to 50 seconds in Kubernetes 1.32 and later; releases before 1.32, and material written for them, use 40 seconds. Pressure conditions become taints the same way, such as node.kubernetes.io/memory-pressure:NoSchedule, so the scheduler only ever has to look at taints.
Cordon and drain
Taking a node out of service is two separate steps.
kubectl cordon sets spec.unschedulable: true. The node lifecycle controller mirrors that as the taint node.kubernetes.io/unschedulable:NoSchedule, and the scheduler stops placing pods there. Nothing that is already running moves.
kubectl drain cordons the node and then sends an eviction request through the Eviction API for each of its pods, all in parallel. That is the important part: drain runs in the client, and each eviction is a request the API server can refuse when it would break a PodDisruptionBudget, in which case drain waits five seconds and retries that pod. Drains started by other clients, such as Karpenter or a managed node group upgrade, use the same API and get the same protection. The kubelet does not drain anything. The pods it evicts on its own come from node-pressure eviction, when memory, disk or PIDs run short, and from graceful node shutdown, covered below. Neither consults PodDisruptionBudgets, and node-pressure eviction under a hard threshold also skips the pods’ termination grace period.
Drain stops before touching three kinds of pod, because evicting them is either pointless or destructive:
| Pod | Why drain refuses | Flag | What the flag gives up |
|---|---|---|---|
| DaemonSet pods | The DaemonSet controller ignores the unschedulable taint and would recreate them on the same node | --ignore-daemonsets | Nothing; they stay and keep running |
Pods with emptyDir volumes | The volume’s contents are deleted with the pod | --delete-emptydir-data | The scratch data |
| Pods with no controller | Nothing will recreate them | --force | The pod itself |
The button drains the worker with the most of your pods, with all three flags, the way the transcript above ends. web’s pod there is evicted and its ReplicaSet starts a replacement on another worker; scratch, which has no controller, is gone for good.
Drain a worker
- Runs kubectl drain <worker> --ignore-daemonsets --delete-emptydir-data. The node is cordoned and its pods evicted; their controllers start them elsewhere.
Each button runs its command on the cluster. This line follows what happens next.
kubectl get pods -A -o wide --field-selector spec.nodeName=kx-worker2
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES default scratch 1/1 Running 0 20s 10.244.2.2 kx-worker2 <none> <none> default web-89c8ffd94-nshlv 1/1 Running 0 20s 10.244.2.3 kx-worker2 <none> <none> kube-system kindnet-ctm5s 1/1 Running 0 45s 172.18.0.4 kx-worker2 <none> <none> kube-system kube-proxy-vcmn6 1/1 Running 0 45s 172.18.0.4 kx-worker2 <none> <none>
kubectl cordon kx-worker2
node/kx-worker2 cordoned
kubectl get nodes
NAME STATUS ROLES AGE VERSION kx-control-plane Ready control-plane 50s v1.37.0 kx-worker Ready <none> 45s v1.37.0 kx-worker2 Ready,SchedulingDisabled <none> 45s v1.37.0 kx-worker3 Ready <none> 45s v1.37.0
kubectl drain kx-worker2
node/kx-worker2 already cordoned error: unable to drain node "kx-worker2" due to error: [cannot delete Pods with local storage (use --delete-emptydir-data to override): default/scratch, cannot delete DaemonSet-managed Pods (use --ignore-daemonsets to ignore): kube-system/kindnet-ctm5s, kube-system/kube-proxy-vcmn6], continuing command... There are pending nodes to be drained: kx-worker2 error: [cannot delete Pods with local storage (use --delete-emptydir-data to override): default/scratch, cannot delete DaemonSet-managed Pods (use --ignore-daemonsets to ignore): kube-system/kindnet-ctm5s, kube-system/kube-proxy-vcmn6]
kubectl drain kx-worker2 --ignore-daemonsets --delete-emptydir-data --force
node/kx-worker2 already cordoned Warning: deleting Pods that declare no controller: default/scratch; ignoring DaemonSet-managed Pods: kube-system/kindnet-ctm5s, kube-system/kube-proxy-vcmn6 evicting pod default/scratch evicting pod default/web-89c8ffd94-nshlv pod/web-89c8ffd94-nshlv evicted pod/scratch evicted node/kx-worker2 drained
kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES web-89c8ffd94-9k22x 1/1 Running 0 30s 10.244.3.3 kx-worker3 <none> <none> web-89c8ffd94-dq87d 1/1 Running 0 50s 10.244.3.2 kx-worker3 <none> <none> web-89c8ffd94-pggpj 1/1 Running 0 50s 10.244.1.3 kx-worker <none> <none>
kubectl uncordon kx-worker2
node/kx-worker2 uncordoned
The first drain refused and listed every blocked pod at once, each under the first rule it broke: scratch appears for its emptyDir, though it has no controller either. The second accepted all three costs: the bare scratch pod is gone for good with its scratch data, and the web replica came back on kx-worker3. Only the DaemonSet pods remain on the drained node. --timeout bounds how long drain waits for evictions; without it, a drain blocked by a budget waits indefinitely.
When drain finishes, the node is still cordoned. Either remove the machine or run kubectl uncordon after maintenance. Two things can still land on a drained node: pods that tolerate the unschedulable taint, which is why only DaemonSets should, and pods created with spec.nodeName set directly, which bypass the scheduler entirely.
Node loss
A node that loses power or network sends no warning. The sequence that follows is slow on purpose, because a network partition looks identical to a dead machine:
- Heartbeats stop. After the 50-second grace period the node turns
Ready=Unknownand gets thenode.kubernetes.io/unreachable:NoExecutetaint. - Every pod carries a toleration for that taint, added automatically with
tolerationSeconds: 300unless the pod sets its own. For five minutes the pods stay bound to the node, in case it comes back. - When the toleration runs out, the taint-based eviction controller deletes the pods. The API server marks them terminating, but no kubelet is there to confirm, so the pod objects stay in Terminating.
- Controllers treat terminating pods as gone. A ReplicaSet creates replacements at once, and the scheduler places them on healthy nodes.
Press Play to watch the sequence on this lesson’s cluster. The stage stops the worker with the most of your pods, holds while its heartbeats age past the grace period, marks it Unknown, and follows web’s pods once their toleration runs out.
kind cluster kx
Starting
Switch to Model to see the set lit by whoever acts.
$
Underneath
DaemonSet pods tolerate the unreachable and not-ready taints with no time limit, so they are never evicted for this reason. StatefulSet pods are the important exception to step 4. A StatefulSet guarantees at most one pod per identity, so it will not create a replacement db-0 while the old db-0 object still exists, even in Terminating. The old object disappears only when the node comes back and its kubelet finishes the deletion, when the Node object is deleted and pod garbage collection removes pods bound to it, or when an administrator who has confirmed the machine is really off steps in: either by force-deleting the pod (kubectl delete pod db-0 --grace-period=0 --force) or by adding the node.kubernetes.io/out-of-service taint, which force-deletes the node’s pods and detaches their volumes. Do neither for a node that might still be running: two copies of the same StatefulSet pod writing to the same volume is the failure the wait exists to prevent.
To trade safety for speed, set a shorter toleration for node.kubernetes.io/unreachable on workloads that recover easily, or a longer one on pods with expensive local state.
Graceful node shutdown
A planned shutdown, such as a reboot or a cloud instance being stopped, can be gentler. With graceful node shutdown, the kubelet takes a systemd inhibitor lock and delays the operating system’s shutdown for a configured time. When it detects the shutdown, it sets the node’s Ready condition to false with the reason “node is shutting down”, rejects incoming pods, and terminates the running ones through the normal termination path. kubectl get pods shows the pods it terminated as Terminated, and kubectl describe pod gives the reason Terminated with the message “Pod was terminated in response to imminent node shutdown”.
The feature is enabled by default on Linux but does nothing until you configure two kubelet settings, which both default to zero:
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
shutdownGracePeriod: 30s
shutdownGracePeriodCriticalPods: 10s
With these values the node waits 30 seconds: the first 20 for ordinary pods and the last 10 for critical pods such as system-node-critical add-ons. For finer control, shutdownGracePeriodByPodPriority assigns a grace period to each priority band, so a cluster can give databases three minutes and batch pods ten seconds. Graceful shutdown is not a drain: it does not use the Eviction API and does not consult PodDisruptionBudgets. Drain before planned maintenance, and treat graceful shutdown as the safety net for the shutdowns nobody announced.
Node requirements
A node image that joined a cluster on one Kubernetes release can fail to join a later one. These requirements changed between Kubernetes 1.24 and 1.37:
- Container runtime. Kubernetes 1.36 and later need containerd 2.0 or later; Kubernetes 1.35 was the last release to support containerd 1.x. Docker Engine has not been a built-in runtime since dockershim was removed in Kubernetes 1.24; using it requires the external
cri-dockerdadapter. - cgroup v2. From Kubernetes 1.35 the kubelet refuses to start on a cgroup v1 host by default (
failCgroupV1: true). The override still exists in 1.37, and SIG Node has announced that the v1 fallback is scheduled for removal in 1.38. - Swap. Node swap support has been stable since Kubernetes 1.34, but the kubelet still refuses to start on a Linux node with swap enabled unless
failSwapOn: falseis set. Even then the defaultswapBehaviorisNoSwap, so pods use swap only when a node is configured withLimitedSwap.
kube-proxy, the other agent on every node, has its own history. It programs Service routing from EndpointSlices; the v1 Endpoints API is deprecated as of Kubernetes 1.33. The default mode on Linux is iptables, and nftables mode has been GA since 1.33. IPVS mode has been deprecated since 1.35: the virtual IPs reference schedules it to be off by default in 1.40 and removed in 1.43, and a SIG Network post of 2026-11-16 moves removal to 1.40. Clusters on IPVS mode have to move to nftables mode, which the project built to replace it, or to iptables mode.
Looking inside
Two tools read the host without SSH. kubectl debug node/NAME creates a pod on that node in the host’s network, PID and IPC namespaces, with the node’s root filesystem mounted at /host. From there you can read /host/var/log or inspect the node’s processes. The default general profile does not make the pod privileged, so chroot /host fails; --profile=sysadmin grants it, and chroot /host stat -fc %T /sys/fs/cgroup then runs the node’s own stat, which prints cgroup2fs on a cgroup v2 host. Busybox’s stat does not know that file system and prints UNKNOWN. On kind, where each node is a container, docker exec reaches the node without a debug pod. Delete the debugger pod when you are done, since it keeps running.
Node log query, stable since Kubernetes 1.36, reads service logs through the API server and the kubelet: kubectl get --raw "/api/v1/nodes/NAME/proxy/logs/?query=kubelet". The kubelet answers it only when its configuration sets both enableSystemLogHandler and enableSystemLogQuery to true, and enableSystemLogQuery defaults to false. The caller also needs permission on nodes/proxy. Grant that permission carefully: nodes/proxy also reaches kubelet APIs that can run commands in any container on the node.
kubectl --context kind-kx get lease -n kube-node-leasekubectl --context kind-kx describe node kx-workerdocker exec kx-worker stat -fc %T /sys/fs/cgroupdocker exec kx-worker systemctl status kubelet
For your own kind cluster kx: copy a command and paste it into your terminal. Run in the simulator runs the same command in this page's simulated cluster instead; nothing on this page touches your machine. stat prints cgroup2fs on a cgroup v2 host. systemctl shows the kubelet as a systemd service on the node, with its drop-in files and its cgroup under kubelet.slice.
Actual state
Check your understanding
Your first answer to each check is the one that counts. After a miss you can answer again; passing every check reconciles the lesson.
Lesson not yet reconciled
Desired: 4 objectives, 0 metReconciled: 4 of 4 objectives met
- Read node conditions, capacity, allocatable and the Lease heartbeat. (not yet met)
- Cordon and drain a node and say what drain does to each kind of pod. (not yet met)
- Explain graceful node shutdown and what happens to pods on a node that disappears. (not yet met)
- Check a node's runtime, kernel and cgroup setup from the API and from a debug pod. (not yet met)
Pass every check above to reconcile this lesson.
Every check has passed, so the desired state is met. First-try accuracy: 0 of 5. This lesson's review cards are in your queue.
Practice
Put this lesson to work on the simulated cluster. Everything runs in your browser, with nothing to install.
Changed since the notes
This lesson draws on an earlier set of study notes. Where the documentation contradicts a claim in them, qualifies it or has moved past it, the claim is listed here with the corrected statement and the source it was checked against.
Show 7 corrections
The notes saidIPVS mode is recommended for large clusters
CorrectedIPVS is deprecated since v1.35. The docs say it is disabled by default from v1.40 (re-enable with the KubeProxyIPVS gate) and removed in v1.43, while the 2026-11-16 blog plans removal in v1.40. Use nftables mode (GA in v1.33), which on EKS needs 1.33+, is recommended from 1.36, and needs VPC CNI v1.23.0+.
The notes saidKube-proxy watches the API server for Service and Endpoint changes
Correctedkube-proxy consumes EndpointSlices. The v1 Endpoints API is deprecated as of v1.33.
The notes saidDocker can still be used through a deprecated compatibility layer
Correcteddockershim was removed in v1.24. Docker Engine now needs the external cri-dockerd adapter.
The notes saidThe EKS-optimized AMIs include a bootstrap script
CorrectedEKS AL2 AMIs reached end of support on 2025-11-26, and 1.32 was the last version with AL2 AMIs. AL2023 AMIs use nodeadm with a NodeConfig, and Bottlerocket uses TOML settings.
Sourcedocs.aws.amazon.com/eks/latest/userguide/eks-ami-deprecation-faqs.html
The notes saidEKS-optimized AMIs include default resource reservations based on instance type
CorrectedOn AL2023, nodeadm computes kubelet reservations from the instance type. The current formula was not re-verified.
The notes saidIf the node needs to drain for maintenance, the kubelet evicts pods gracefully
CorrectedDrains run client-side (kubectl drain, Karpenter, managed node groups) through the Eviction API, which honours PDBs. The kubelet only does node-pressure eviction, which ignores PDBs and terminationGracePeriodSeconds.
Sourcekubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction
The notes saidAWS Fargate eliminates nodes entirely
CorrectedThere are no nodes to manage, but each Fargate Pod runs on its own fargate-ip-… Node object.
Sourcedocs.aws.amazon.com/eks/latest/userguide/fargate-pod-configuration.html
Every correction across the guide, by note and topic.
Sources
Checked against kubernetes.io and AWS documentation for Kubernetes 1.37 on .
- kubernetes.io/docs/concepts/architecture/nodes
- kubernetes.io/docs/reference/node/node-status
- kubernetes.io/docs/tasks/administer-cluster/safely-drain-node
- kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration
- kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction
- kubernetes.io/docs/concepts/cluster-administration/node-shutdown
- kubernetes.io/docs/concepts/cluster-administration/swap-memory-management
- kubernetes.io/docs/concepts/cluster-administration/system-logs
- kubernetes.io/docs/tasks/debug/debug-cluster/kubectl-node-debug
- kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources
- kubernetes.io/docs/reference/networking/virtual-ips
- kubernetes.io/blog/2026/11/16/ipvs-removal
- kubernetes.io/docs/reference/config-api/kubelet-config.v1beta1
- kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod
- kubernetes.io/blog/2022/02/17/dockershim-faq
- docs.aws.amazon.com/eks/latest/userguide/eks-ami-deprecation-faqs.html
- docs.aws.amazon.com/eks/latest/userguide/al2023.html
- docs.aws.amazon.com/eks/latest/userguide/automode.html
- docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html
- docs.aws.amazon.com/eks/latest/userguide/choosing-instance-type.html
- docs.aws.amazon.com/eks/latest/userguide/fargate.html
Nodes and the kubelet
↓ ↑ step, 1 to 7 scene, Esc leave