Korab CenajTechnical articleAll articles

Kubernetes maintenance · 3 min read

Why kubectl drain is not enough

A completed drain is often treated as permission to reboot, replace, or power off a node. It reports a narrower fact: Kubernetes accepted or completed a set of pod evictions. Maintenance still has to preserve workload availability, data access, control-plane quorum, and a credible return path for the node and every displaced workload.

What the command actually establishes

kubectl drain marks the node unschedulable and asks the eviction API to remove eligible pods. The eviction API enforces current PodDisruptionBudget allowance; workload controllers and the scheduler, not drain itself, create and place replacements. Completion therefore does not establish that replacements became healthy, volumes reattached, or Services kept usable backends. DaemonSet, static, unmanaged, and local-data pods also need explicit interpretation. Flags that bypass a blocker change command behavior; they do not create spare capacity or redundancy. Drain also does not remove a control-plane server from etcd membership.

The misconception persists because command success is immediate and legible, while the relevant conditions live across controllers. Capacity, scheduling rules, storage topology, endpoint distribution, existing failures, and the node’s role must be correlated before the disruptive step begins. The decision must describe the intended outage and its duration, not merely whether a pod can be deleted now.

A maintenance decision path

  1. Define the target role and intended outage.
  2. Measure workload health and PDB allowance.
  3. Test placement against real scheduler constraints.
  4. Check volume attachment and replica locality.
  5. Count surviving Service endpoints.
  6. Preserve etcd majority throughout the outage.
  7. Set abort, return, and post-change gates.

An illustrative, sanitized blocker

Example: illustrative and sanitized
Decision: BLOCKED
Target: control-plane server and etcd member
PDB allowance: 0 disruptions
Replacement placement: feasible
Storage attachment: not established
etcd: 3 members; 1 already unavailable
Planned outage: 1 of 3 members would remain

Aggregate CPU looks sufficient, yet two independent constraints stop the plan. The PDB allows no voluntary disruption, and taking a second etcd server offline would leave one available member where a three-member cluster requires two for quorum. The cluster may be serving with two members while one server is unavailable, but it has already consumed its single-failure tolerance. Drain would neither repair that server nor change membership. The operator should restore cluster health first and then reassess; deleting the PDB or casually removing an etcd member merely to make the command pass would change the system’s protection model. Membership changes require their own quorum-aware procedure.

Questions to answer before proceeding

From command success to maintenance judgment

A node can be drainable yet not maintainable under present conditions, and that distinction should be recorded before anyone begins work. The measured conclusion is not that drain is inadequate; it is that drain belongs after the go/no-go decision and before explicit recovery checks. The Kubernetes Maintenance Orchestrator case study applies this model to workload disruption, placement, endpoints, storage, quorum, and return conditions. Its published assessment and plan were non-mutating; execution is a separately guarded path with separate authority and an auditable operator decision.