Nodes: NotReady, cordon and drain, PDBs, and upgrades

Cordon stops new pods, drain evicts existing ones, and PodDisruptionBudgets decide whether the drain can proceed. NotReady is the kubelet's own report, not the node being off.

Read the briefing
About 8 min to read 7 drills

What to remember

  1. Cordon then drain, and respect PDBs. A drain that hangs is usually a PDB with nowhere to move the pod to.
  2. NotReady means the kubelet stopped reporting. Could be kubelet, network or the node. Pods are evicted after the toleration seconds, not instantly.
  3. Node pressure evicts by QoS and usage over requests. Which is why honest requests matter more than any eviction tuning.
  4. Upgrades are a rolling drain — one node at a time, verified. Surge nodes make it faster and safer than in-place.
  5. A single-replica workload plus a PDB blocks every drain. Two replicas, or accept the disruption explicitly.

The big picture

Nodes are where the control plane's picture of the cluster meets reality, and the node lifecycle is how that picture is kept honest: kubelet heartbeats and conditions, the NotReady timeline that ends in pods being evicted, the cordon-and-drain protocol for planned maintenance, PodDisruptionBudgets as the contract between operators and workloads, and the ordering rules for upgrades. Interviewers use it to separate people who have run clusters from people who have deployed to them, because every stuck drain, every "pods still Terminating" ticket and every botched upgrade lives here.

The mental model

Two kinds of disruption with two different rulebooks. Involuntary disruption (a node dies, the kubelet stops heartbeating) is handled by timeouts and taints: the control plane waits, gives up, and lets controllers rebuild elsewhere; nothing negotiates. Voluntary disruption (drain, autoscaler scale-down, upgrades) goes through the Eviction API, which asks each PodDisruptionBudget for permission and waits politely, forever if it has to. Most node incidents are one of those rulebooks being applied where you expected the other.

In depth

Heartbeats, conditions and the NotReady timeline

The kubelet reports in two ways: it renews a Lease in the kube-node-lease namespace every 10 seconds, and it posts a full NodeStatus (conditions, allocatable, images) whenever something changes, checked every 10 seconds, and at least every five minutes regardless. The node lifecycle controller in kube-controller-manager checks each node every 5 seconds; if it has heard nothing for the node monitor grace period (40 seconds by default) it sets Ready=Unknown (reason NodeStatusUnknown, message Kubelet stopped posting node status) and taints the node node.kubernetes.io/unreachable:NoExecute (or not-ready when the kubelet itself reports Ready=False).

Pods are evicted by that taint, not by a separate timer. Every pod gets a default toleration for the two taints with tolerationSeconds: 300, so five minutes after the taint lands the taint manager deletes the pods. Deleted is not gone: the kubelet that would run the graceful shutdown is unreachable, so the pods sit in Terminating until the node returns or the Node object is deleted. Deployments do not care, because a ReplicaSet counts a terminating pod as absent and creates a replacement at once. StatefulSets do care: their at-most-one guarantee means db-1 is not recreated while the old db-1 is still Terminating, which is why a dead node under a StatefulSet needs a human (or a fencing controller) to confirm the node is really gone before force-deleting the pod.

Conditions beyond Ready are the kubelet's own diagnoses: MemoryPressure, DiskPressure and PIDPressure flip to True when eviction thresholds are crossed, each adds a matching NoSchedule taint, and NetworkUnavailable means the CNI has not configured the node. Read them with kubectl describe node and, on the node, journalctl -u kubelet for the why (PLEG unhealthy, runtime not responding, disk full under /var/lib/containerd). Tune the timeline per workload with explicit tolerationSeconds: a stateless API can tolerate 30 seconds, a database might prefer 600.

cordon, drain and the Eviction API

kubectl cordon <node> sets spec.unschedulable: true, which the scheduler honours through the node.kubernetes.io/unschedulable:NoSchedule taint. Nothing running is touched; new pods simply cannot land. kubectl uncordon reverses it. kubectl drain <node> cordons first and then, for every pod on the node, creates an Eviction through the pods/eviction subresource. The API server checks the pod's PodDisruptionBudgets: if the eviction would take a budget below its floor it answers 429 Too Many Requests with Cannot evict pod as it would violate the pod's disruption budget, and kubectl retries every five seconds, indefinitely. An allowed eviction is an ordinary graceful delete: preStop, SIGTERM, terminationGracePeriodSeconds, SIGKILL.

Drain skips or refuses some pods on purpose. DaemonSet pods are refused unless --ignore-daemonsets, because their controller would recreate them on the still-cordoned node anyway (they tolerate the unschedulable taint). Pods with emptyDir data are refused unless --delete-emptydir-data, since the data dies with the pod. Pods without a controller are refused unless --force, because nothing will bring them back. Static (mirror) pods are silently skipped; the kubelet owns them. --disable-eviction switches from evictions to plain deletes and therefore ignores PDBs, which is the flag to be suspicious of in a runbook. --timeout makes a stuck drain fail instead of hanging, which is what you want in automation.

The same Eviction API is used by the cluster autoscaler when it removes a node, by the descheduler, and by managed-provider upgrades and auto-repair, so a budget that blocks kubectl drain blocks all of them. When a drain is stuck, the evidence is in the drain output (which pod) and in kubectl get pdb -A (which budget shows ALLOWED DISRUPTIONS 0).

PodDisruptionBudgets: what they protect and what they do not

A PDB names a selector and either minAvailable or maxUnavailable, as an integer or a percentage. status.disruptionsAllowed (the ALLOWED DISRUPTIONS column) is recomputed from the number of healthy pods, meaning Ready, so a Deployment with three replicas, maxUnavailable: 1 and one pod stuck in CrashLoopBackOff already allows zero disruptions. Percentages round conservatively: minAvailable rounds up, maxUnavailable rounds down. The budget only ever answers one question, asked by the Eviction API: may this one pod be evicted right now?

It therefore protects against voluntary disruptions only: drains, autoscaler scale-down, descheduling, provider upgrades. It does nothing when a node loses power, when the kubelet OOMs, when someone runs kubectl delete pod, or when a Deployment rollout replaces pods (that is governed by maxUnavailable in the rollout strategy). Scheduler preemption honours PDBs best-effort, not absolutely. Candidates who say "the PDB will keep two replicas up during the outage" have the wrong rulebook.

Two budgets are traps. A budget that can never be satisfied (minAvailable equal to the replica count, minAvailable: 100%, or a single replica with minAvailable: 1) allows zero disruptions permanently and turns every drain into a hang; the fix is more replicas or a budget that allows one disruption, never --disable-eviction. A budget whose application is already below its floor blocks eviction of even its unhealthy pods under the default unhealthyPodEvictionPolicy: IfHealthyBudget, so two crash-looping replicas out of three can pin a node forever; AlwaysAllow lets pods that are not Ready be evicted regardless, which is the right setting for most stateless services. Check budgets before any maintenance: kubectl get pdb -A -o custom-columns=NS:.metadata.namespace,NAME:.metadata.name,ALLOWED:.status.disruptionsAllowed and treat a zero as a blocker to fix, not to bypass.

Upgrades: order, version skew and pre-checks

The API server is the reference version and everything else is constrained relative to it. Control-plane components (controller-manager, scheduler, cloud-controller-manager) may be at most one minor version older than the API server, never newer. Kubelets and kube-proxy may be up to three minor versions older, never newer. kubectl may be one minor either side. Those rules dictate the order: back up etcd, upgrade every API server instance (one at a time in HA), then controller-manager and scheduler, then verify (leases held, Deployments progressing, kubectl get --raw /metrics | grep apiserver_requested_deprecated_apis quiet), and only then the nodes. The control plane moves one minor at a time; a node can jump several minors in one replacement as long as it lands inside the skew window, which is what blue/green node pools rely on.

Pre-checks are where staff candidates separate themselves. Read the release notes for removed APIs and run a deprecation scan (kubent, pluto, or the metric above) against manifests and Helm releases, because a chart that renders a removed version fails only after the upgrade. Confirm the CNI, CSI drivers, ingress controller and any admission webhooks support the target version; a DaemonSet that crashes on new nodes stalls the whole pool. Audit PDBs for zero allowed disruptions and check there is capacity for the pods a drained node will shed. Drain one node by hand first as a canary.

What still goes wrong: a removed API breaking a controller or chart; a drain stuck on an unsatisfiable PDB or a pod with local state; a kubelet that comes up newer than the API server on a self-managed node; and the fact that a control-plane downgrade is not supported, so the rollback point is the etcd snapshot you took, which loses every change made since.

Surge upgrades and capacity during maintenance

Every drain is a capacity event: the pods on the node need somewhere to go, and PDBs correctly refuse to move a pod that has nowhere to land. Without surge, an in-place upgrade removes a node before adding one, so the pool runs at N-1 during every drain and needs N+1 headroom, which nobody keeps by accident. With surge, the provider (or your automation) adds a replacement node first, waits for it to be Ready, then cordons and drains the old one, so capacity never dips and drains rarely stall. The cost is temporary extra nodes and the quota, IP addresses and licences to run them; the failure mode is a surge node that cannot join (subnet exhausted, image pull failing, CNI not ready), which pauses the upgrade harmlessly instead of shrinking the pool.

Managed offerings expose this as a max-surge and max-unavailable pair on the node pool, and most default to surge one, unavailable zero. Set them explicitly in your infrastructure code: maxUnavailable above zero is a decision to run under capacity that someone should have to write down. Blue/green node pools are surge taken to the limit: build a whole new pool at the target version, cordon the old pool, drain it at a controlled rate, delete it when empty, with the old pool as a live rollback point.

Verify capacity before you start, not during: pending-pod count and the Allocated resources table from kubectl describe node across the pool tell you whether N-1 fits. During the rollout watch pending pods, PDB allowed disruptions and the latency SLO pool by pool, and keep the option to pause. The interview shape is the same as any incident: identify the blocker, restore capacity rather than weaken guardrails, then make headroom and budget validation part of the procedure.

Myths and facts

Myth: NotReady means the pods on that node have been killed.

Fact: NotReady is a statement about heartbeats. Containers may still be serving. Pods are deleted only after the unreachable taint's tolerationSeconds (300 by default), and even then they sit in Terminating until the node returns or is removed.

Myth: A PodDisruptionBudget keeps my replicas up when a node fails.

Fact: PDBs govern voluntary evictions through the Eviction API only. Node crashes, kubelet failures and kubectl delete pod bypass them completely.

Myth: kubectl drain --force bypasses the PDB when a drain is stuck.

Fact: --force only allows deleting pods that have no controller. Bypassing PDBs is --disable-eviction, which turns evictions into plain deletes and should almost never appear in a runbook.

Myth: cordon evicts pods gracefully.

Fact: cordon only marks the node unschedulable; nothing running is touched. drain is cordon plus PDB-aware eviction.

Myth: minAvailable: 100% is the safest budget.

Fact: It allows zero disruptions forever, so every drain, autoscaler scale-down and upgrade stalls on it. Safety looks like a budget that allows at least one disruption at the current replica count.

Myth: Nodes can be upgraded first if the versions are close.

Fact: The kubelet must never be newer than the API server. Control plane first, one minor at a time; nodes may lag by up to three minors and catch up in one replacement.

How pros do it

  • Give every multi-replica workload a PDB that allows at least one disruption at its current replica count, and alert on any PDB reporting zero allowed disruptions for longer than a rollout takes.
  • Set unhealthyPodEvictionPolicy: AlwaysAllow on budgets for stateless services so a crash-looping replica cannot block drains forever.
  • Upgrade with surge (add before remove) and encode max-surge/max-unavailable in infrastructure code; if surge is unavailable, enforce N+1 headroom through the autoscaler's minimum.
  • Run a written pre-upgrade checklist: etcd snapshot, deprecated-API scan of manifests and Helm releases, CNI/CSI/webhook compatibility, PDB audit, capacity check, canary node.
  • Never bypass a PDB during an incident; add capacity or fix the budget. If you must, record who decided and why, because it is a deliberate choice to run under the declared floor.
  • Alert on Ready=Unknown lasting more than two minutes, on pressure conditions, and on pods Terminating longer than their grace period; give StatefulSets a documented dead-node procedure that fences before force-deleting.

Questions people ask

Why has my drain been running for an hour?

Say 'almost always a PDB that cannot be satisfied' and name the evidence: the drain output names the pod, and kubectl get pdb -A shows ALLOWED DISRUPTIONS 0. The other cause is a pod that will not terminate within its grace period. Then the fix: the budget or capacity, never --disable-eviction, and --timeout in automation so it fails instead of waiting.

How long until pods on a dead node are rescheduled?

Give the timeline: about 40 seconds for the node to become NotReady plus 300 seconds of default toleration before the taint manager deletes the pods, so roughly six minutes. Then say it is taint-based and tunable: tolerationSeconds on the pod shortens or lengthens it per workload, and StatefulSet pods stay Terminating until the node is confirmed gone.

Does a PDB stop kubectl delete pod or a Deployment rollout?

Say no: only the Eviction API consults PDBs. Direct deletes ignore them, and rollouts are bounded by the Deployment's own maxUnavailable, not by the budget. Then complete the picture: node crashes bypass PDBs too, so the budget protects against voluntary disruption only.

Do I have to cordon before I drain?

Say no, drain cordons first. Then say when cordon alone is the right tool: stopping new placement while you investigate without moving anything. Two verbs, two effects.

What happens to DaemonSet pods during a drain?

They are skipped (with --ignore-daemonsets) and keep running, because they tolerate the unschedulable taint and their controller would recreate them anyway. Say that the node's agents therefore stay up until the node itself is removed, which is what you want for logging and the CNI.

Can I upgrade two minor versions at once?

Say 'not the control plane': it moves one minor at a time with verification between. Then the nuance: nodes can be replaced straight to the target as long as they end up no more than three minors behind the API server, and never ahead of it. Citing the skew rule is what justifies the order.

What is the difference between an Evicted pod and a drain eviction?

Two rulebooks: Evicted (the status) is the kubelet reclaiming memory or disk under node pressure; it ignores PDBs and marks the pod Failed. A drain eviction is an API request that honours PDBs and performs an ordinary graceful delete. Say involuntary versus voluntary and you have framed it correctly.

Further reading

Drills · 7

Answer in your head, or out loud, before you reveal. Mark each one: "Again" brings it back, "Got it" counts on your desk.

1 Pick the strongest answer

kubectl drain node-b has been printing Cannot evict pod as it would violate the pod's disruption budget for twenty minutes. The pod belongs to a Deployment with 1 replica and a PDB of minAvailable: 1. What is going on and what is the right fix?

  1. Use --force to make drain delete the pod. --force only applies to pods without a controller; and bypassing a PDB with --disable-eviction defeats the protection someone asked for.
  2. Delete the PDB; PDBs are only for StatefulSets. PDBs apply to any pods matching the selector; the PDB is doing its job, it is just unsatisfiable.
  3. Wait; the eviction will succeed once the pod's grace period expires. PDB checks do not time out; drain retries forever.
  4. The PDB can never be satisfied during a voluntary disruption of a single replica; either scale the Deployment to 2 first, or change the PDB (maxUnavailable: 1), then drain. minAvailable 1 with 1 replica means zero disruptions allowed; drain correctly refuses. Fix the budget or the replica count, not the drain.
In short

The PDB can never be satisfied with one replica, so scale to 2 or change the budget, then drain.

Why

A PDB is a promise about voluntary disruptions: never fewer than N available. With one replica, keeping one available means never evicting, so every drain stalls. This is a design smell (single replica plus a budget), and the interview-preferred answer fixes the design, not the tool. Interviewers also like hearing that PDBs do nothing for involuntary failures like node crashes.

The common mistake

Reaching for --force or --disable-eviction to push the drain through. That removes the protection someone asked for; the fix is the replica count or the budget, and it should be raised as a design bug.

Read the docs

2 Answer out loud

Walk me through upgrading a production cluster by one minor version with zero customer-visible impact: the order, what you check before each step, and what can still go wrong. Four to six sentences.

In short

A strong answer upgrades the control plane first, then nodes with surge and drain, with a check before each step.

What a strong answer does
  • procedure: Read release notes and API deprecations, back up etcd, upgrade control plane (one minor at a time), verify, then nodes with surge/cordon/drain, honouring PDBs, one pool at a time, with rollback points.
  • risk awareness: Names several: removed APIs breaking manifests, stuck drains from PDBs, capacity during drains, DaemonSet/CNI compatibility, kubelet skew rules, workloads with local state.
  • communication: Ordered steps each paired with its check and its rollback.
Why

Staff-level answers pair every step with its check and its rollback, and they name the failure modes in advance rather than discovering them during the drain.

The common mistake

Upgrading nodes first 'because the versions are close', or claiming the control plane can be rolled back. It cannot be downgraded; its rollback is the etcd snapshot, which loses everything since.

3 Pick the strongest answer

Before you take node-a down for maintenance: kubectl cordon node-a or kubectl drain node-a? What does each actually do?

  1. cordon only marks the node unschedulable; drain also evicts the pods on it through the Eviction API, honouring PodDisruptionBudgets. cordon is a scheduling gate; drain is cordon plus a PDB-aware eviction of what is already there.
  2. cordon evicts pods gracefully; drain deletes them immediately. cordon touches nothing running; only new placement is blocked.
  3. They are aliases; drain is the newer name. Different verbs, different effects.
  4. drain removes the node from the cluster; cordon keeps it. Neither removes the node object; drain prepares it for maintenance.
In short

cordon only stops new pods landing on the node; drain also evicts the pods already there while honouring PDBs.

Why

Maintenance is a two-step idea: stop new work arriving, then move existing work off safely. drain uses the Eviction API so PDBs are respected, skips DaemonSet pods (they would just come back), and refuses to delete pods with emptyDir data unless told to. Interviewers check that you know drain is polite and can therefore get stuck.

Read the docs

4 Read the output

What is the kubelet doing, and what should you check first?

$ kubectl describe node worker-4 | sed -n '/Conditions:/,/Addresses:/p'
Conditions:
  Type             Status  LastHeartbeatTime   Reason                       Message
  ----             ------  -----------------   ------                       -------
  MemoryPressure   False   14:02:11            KubeletHasSufficientMemory   kubelet has sufficient memory available
  DiskPressure     True    14:02:11            KubeletHasDiskPressure       kubelet has disk pressure
  PIDPressure      False   14:02:11            KubeletHasSufficientPID      kubelet has sufficient PID available
  Ready            True    14:02:11            KubeletReady                 kubelet is posting ready status

$ kubectl get pods -o wide --field-selector spec.nodeName=worker-4 | head -3
NAME                    READY   STATUS    RESTARTS   AGE   NODE
ingest-6b7f9-x2ll9      1/1     Running   0          2d    worker-4
ingest-6b7f9-m8dq2      0/1     Evicted   0          3m    worker-4
  1. The pod was evicted because its liveness probe failed. Probes restart containers; eviction is the kubelet reclaiming node resources, and the pod status says Evicted.
  2. The node is about to go NotReady; cordon it immediately. Pressure conditions are independent of Ready; the kubelet is healthy and actively reclaiming.
  3. The node is under disk pressure: the kubelet is evicting pods and garbage-collecting images to reclaim space; check df on the container runtime and kubelet filesystems and which pods write to local disk or emptyDir. DiskPressure True with a fresh Evicted pod is node-pressure eviction in progress; the node stays Ready because the kubelet itself is healthy.
  4. Memory is the real problem since ingest pods use a lot of RAM. MemoryPressure is False; the condition that is True is disk.
In short

The node has disk pressure and the kubelet is evicting pods to free space, so check disk use on the node first.

Why

Node conditions are the kubelet's own diagnosis. DiskPressure means the node filesystem or the image filesystem crossed an eviction threshold, and the kubelet responds by deleting unused images and evicting pods ranked by disk usage relative to their ephemeral-storage requests. Reading the condition that is True, rather than assuming memory, is the interview signal.

Read the docs

5 Find what's broken

Node drains in the shop namespace never complete, and the cluster autoscaler cannot scale down. Which line?

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: api-pdb
  namespace: shop
spec:
  minAvailable: 100%
  selector:
    matchLabels:
      app: api
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api
  namespace: shop
spec:
  replicas: 3
  selector:
    matchLabels: { app: api }
  template:
    metadata:
      labels: { app: api, tier: web }
    spec:
      containers:
        - name: api
          image: registry.example.com/api:5.0
In short

minAvailable 100% allows zero disruptions, so no drain or scale-down can ever evict an api pod.

What's broken
  • Line 7: minAvailable: 100% allows zero disruptions, so every voluntary eviction of an api pod is refused forever; drains and autoscaler scale-downs stall.
Why

A PDB expresses how much voluntary disruption is acceptable; 100% available means none. It looks like maximum safety and behaves like a lock on the whole node pool: nothing that uses the Eviction API (drain, autoscaler, node auto-repair) can proceed. The healthy pattern is a budget that allows at least one disruption at the current replica count.

Read the docs

6 Scenario: what do you do next?

You are upgrading a 12-node production cluster from 1.29 to 1.30 with a managed node pool that replaces nodes one at a time (no surge). The third node's drain has been stuck for 40 minutes, the pool is at 11 nodes, and a latency SLO is starting to burn.

Step 1. What do you check first?

  1. Which eviction is blocking the drain and why: kubectl get pdb -A for budgets with ALLOWED DISRUPTIONS 0, and the drain output naming the pod. Stuck drains are almost always a PDB that cannot be satisfied or a pod that will not terminate; the evidence names it.
  2. Force the drain with --disable-eviction. That bypasses the protection someone asked for and can take a service below its budget during an SLO burn.
  3. Delete the stuck node from the cluster. Its pods would be orphaned abruptly; the drain exists to avoid exactly that.
  4. Roll the control plane back to 1.29. Control plane and node skew within one minor version is supported; the block is a drain, not a version.

Step 2. The blocking pod is one of two replicas of search with a PDB minAvailable: 2; the other replica is Pending because the 11-node pool is out of memory for its requests. What is the mitigation?

  1. Let the drain keep waiting; it will succeed eventually. Nothing will change without capacity; meanwhile the SLO burns.
  2. Lower the PDB to minAvailable: 1 and continue. That knowingly runs a service under its declared safety floor during an SLO burn.
  3. Add capacity first (temporarily scale the pool up or enable surge) so the second replica can schedule; then the drain proceeds without violating the budget. Pause the upgrade until then. The PDB is doing its job; the actual problem is missing headroom. Restore capacity, then let the polite path complete.
  4. Reduce search's memory requests so it fits. Changing resource requests mid-incident invites OOMKills; requests should reflect real usage, not the emergency.

Step 3. For the postmortem, what is the systemic fix?

  1. Upgrade only at night. The mechanism is the same at night; only the blast radius is smaller.
  2. Enable surge upgrades (add before remove), a pre-upgrade check that every PDB has allowed disruptions greater than zero at current replica counts, and a capacity headroom rule (N+1 nodes) enforced by the autoscaler's minimum. Capacity during upgrades stops being an accident; unsatisfiable budgets are caught before the drain.
  3. Remove PDBs from all Deployments. That trades a stuck upgrade for unprotected services.
In short

Find the PDB that blocks the drain, add capacity so the pod can move, and then enable surge upgrades and a PDB check.

Why

Upgrades are capacity events. Without surge, every drain needs somewhere for the pods to go, and PDBs correctly refuse to move pods that have nowhere to land. The interview shape: identify the blocker, restore capacity rather than weaken guardrails, then make headroom and budget validation part of the upgrade procedure.

Read the docs

7 Quick recall

Quick one: in an upgrade, what goes first, the control plane or the nodes?

In short

The control plane is upgraded first, and the worker nodes follow.

Accepted

control plane · the control plane · control plane first

Why

Control plane first; kubelets may run older (within the supported skew) but never newer than the API server.

Next lesson Requests, limits, QoS classes, and eviction
Drill · Nodes
0:00

Loading…