Drain cordon and disruption
Cordon changes placement, not running workloads
Cordon marks a node unschedulable for ordinary scheduler placement. Existing Pods are not evicted by cordon alone. Some workloads, including DaemonSets, can tolerate the unschedulable taint; directly binding a Pod can also bypass the usual scheduler placement decision. Uncordon permits ordinary scheduling again, but does not guarantee that the node is healthy. Use explicit context and node identity in any approved lab.
cordon: prevent ordinary new placementsdrain: request removal of eligible existing Podsuncordon: restore ordinary placement eligibilityRead drain as a disruption operation
Drain marks the node unschedulable and normally uses the Eviction API when available. Eviction considers matching PodDisruptionBudgets (PDBs). A successful drain does not power off the machine or remove static Pods. The command requires explicit acknowledgement of DaemonSet-managed Pods using --ignore-daemonsets and leaves those Pods running. Mirror Pods represent static Pods and cannot be removed through the API. Do not mistake a drained worker for an empty host.
# Illustration only; use an authorized disposable contextkubectl --context lab-maintenance get pods -A --field-selector spec.nodeName=worker-akubectl --context lab-maintenance cordon worker-akubectl --context lab-maintenance drain worker-a --ignore-daemonsets --timeout=120sCalculate the disruption budget
Suppose a Deployment has three healthy replicas, one per node, and a PDB with integer minAvailable: 2. One healthy replica can be voluntarily evicted in this simplified model. If a replacement is not ready and only two healthy replicas remain, the next healthy eviction must wait. Real eviction decisions use PDB status, overlapping selectors and current readiness, not a stale spreadsheet. Involuntary failures are not prevented by a PDB; workload rollouts are governed by the controller rather than blocked by PDB admission.
Healthy = 3; required = 2 → allowance = 1Healthy = 2; required = 2 → allowance = 0Check status.disruptionsAllowed and replacement readiness.Protect local state and capacity
A Pod using emptyDir can lose its local data when removed. The delete-emptydir-data option explicitly accepts that loss; it is not a routine maintenance fix. Unmanaged Pods may not be recreated, and local persistent volumes can tie a workload to a node. Force and disable-eviction flags can bypass important safeguards or change the removal mechanism. Stop and consult the workload owner if any such exception is proposed. Ensure spare nodes can accommodate requests, topology constraints and volume attachments.
Stop conditions: unmanaged Pod; unreviewed local data; insufficient spare capacity; blocked eviction; unhealthy replacement.Verify before returning the node
After approved maintenance, check kubelet and runtime health, Node Ready, intended versions, networking, storage and application-level responses. Only then uncordon. Verify a controlled workload can be scheduled and is ready; watch service errors and latency. Keep an explicit stop condition before touching another node. A timeout does not justify bypassing disruption protection.
# Illustrative read-only checks, then authorized mutationkubectl --context lab-maintenance get node worker-akubectl --context lab-maintenance describe node worker-akubectl --context lab-maintenance uncordon worker-aPractice and verification
Use drain-cases.json to classify maintenance blockers and calculate the healthy-replica allowance. Explain why a drained node can retain system Pods. Use only the offline fixtures in lab-fixtures/cluster-maintenance. State which checks require a real authorized cluster.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Drain cordon and disruption — knowledge check
Explain what cordon, drain and uncordon change, and plan safe maintenance around disruption and storage constraints.
What does cordon do to existing ordinary Pods?
Three healthy replicas, minAvailable 2: simple eviction allowance?
What does --ignore-daemonsets do during drain?
An emptyDir holds unreviewed data. What next?
When should a maintained node be uncordoned?