Why draining Kubernetes nodes safely takes planning
When a node needs patching or hardware work, the goal is to move its workloads elsewhere before the node goes offline. In Kubernetes, cordon marks a node as unschedulable so the scheduler places no new pods on it, and drain then evicts the pods already running there so their controllers can recreate them on other nodes. Teams need this whenever a kernel update, runtime upgrade, memory replacement or failing disk would otherwise interrupt the applications scheduled on that node. Cordon alone is safe but leaves existing pods in place, so it does not free the node for maintenance.
Drain is where planning matters, because it is the step that can stop progress or cause an outage. It evicts pods through the Eviction API, which respects PodDisruptionBudgets, so a budget that allows no voluntary disruptions will block the drain until capacity elsewhere allows the eviction. Pods not managed by a controller, DaemonSet pods and pods using local storage also need explicit decisions, because the drain command refuses to proceed past them unless you choose to ignore or delete them. Before starting, confirm which workloads run single replicas, which budgets are set to zero allowed disruptions, and whether the remaining nodes have the spare CPU and memory to absorb the moved pods. Your own cluster's manifests and monitoring will answer these questions, not general guidance.
Returning the node to service is the last step and is easy to forget. Uncordon makes the node schedulable again, but pods do not move back automatically, so the load may stay unevenly spread until workloads are rescheduled or rebalanced. Check that the node reports Ready, that DaemonSet pods have started and that the applications on other nodes are healthy before moving to the next node. For a fleet, agree on the order of nodes, the drain timeout and the rollback step in writing before the window opens. Kubernetes project documentation covers the exact flags, and your team should test the sequence on a non-production cluster first.
Drain options and when each fits
This table compares the drain choices that change what happens to pods on a node, from ignoring DaemonSets to draining one node at a time or in batches. Read each row for the situation where the option fits and the risk it carries, and treat the default safe position as the one that keeps data and disruption limits intact until someone has decided otherwise.
| Option | When it fits | Risk to manage |
|---|---|---|
| Leave DaemonSet pods running (ignore DaemonSets) | Node-level agents such as log shippers, monitoring agents or CNI pods that should keep running while the node is out of scheduling | The flag must be set deliberately. Without it, kubectl drain refuses to proceed while DaemonSet pods are present, which stops the maintenance window |
| Delete emptyDir data (allow local data loss) | Pods using emptyDir only for scratch space or cache that the application can rebuild on another node | Data written to emptyDir is removed with the pod. Confirm each workload's owner has accepted that loss before the drain starts |
| Force unmanaged pods | Standalone pods with no controller that you have confirmed are disposable or can be recreated manually | Unmanaged pods are not rescheduled by a controller, so they do not come back on their own after the drain |
| Set a grace period for pod termination | Workloads that need time to finish requests, flush buffers or leave a cluster gracefully | A long grace period slows the drain. Test the value against the application's real shutdown time, and confirm the setting with the application owner |
| Set a drain timeout | Maintenance windows with a fixed end time where a stuck drain must surface quickly | A timeout that is too short leaves the node half drained. Plan the rollback or the decision to continue before running the command |
| Drain one node at a time | Small clusters, stateful workloads with tight quorum needs, or first-time runs of a new runbook | Slowest option. It protects capacity and quorum but extends the total maintenance window across many nodes |
| Drain nodes in batches | Large pools where capacity headroom and PodDisruptionBudgets have been checked for the whole batch | Several nodes out at once can exhaust capacity or break quorum for shared workloads. Confirm headroom before starting the batch |
PodDisruptionBudgets that block progress
A drain stops when eviction would break a PodDisruptionBudget (PDB), so most stalled maintenance comes from a short list of causes. Each card below names one blocker, how to find it in your cluster, and the safe fix. Work through them before you consider any shortcut, because a drain that is stuck usually reflects a workload that cannot tolerate losing a pod at that moment.
PDB allows zero disruptions
A PDB with maxUnavailable: 0, or a minAvailable equal to the current replica count, permits no voluntary evictions at all. Run kubectl get pdb -A and check the ALLOWED DISRUPTIONS column, then compare it with the owning workload's replica count. The safe fix is to scale the workload so it has spare replicas, or to change the budget deliberately with the application owner's agreement. Do not delete the PDB just to finish the drain.
Single-replica workloads
A Deployment or StatefulSet with one replica and a PDB of minAvailable: 1 cannot lose its only pod without downtime, so the drain waits indefinitely. Find them by listing workloads whose replica count is 1 and that have a matching PDB. Decide with the owner whether the workload needs a second replica, a planned maintenance window, or a short outage it can accept. Scaling to two replicas is usually the fix, provided the application can run more than one copy.
Replicas concentrated on one node
Even with three replicas, all of them may be scheduled onto the node you are draining, so evicting that node removes the whole workload at once. Check placement with kubectl get pods -o wide and compare node names for each workload. The fix is to add topology spread constraints or pod anti-affinity rules so replicas land on different nodes, then let the scheduler rebalance on the next rollout. Confirm the cluster has enough capacity on other nodes before you cordon.
Pods without a controller
Bare pods, which have no ReplicaSet, Deployment or StatefulSet behind them, are not recreated after eviction. Drain refuses to evict them unless you pass --force, and that flag deletes them permanently. List them with a filter on ownerReferences or by checking each pod's owner kind. The safe fix is to wrap the workload in a controller, move it to another node, or confirm with its owner that losing it is acceptable before any forced drain.
Unhealthy pods counted against the budget
Pods that are crashlooping, pending or not ready can still count against a PDB, which lowers the number of disruptions allowed when the workload is already degraded. Check kubectl get pdb alongside pod readiness and recent events. Restore the failed pods first, because evicting a healthy pod from a degraded workload is the riskiest move in the sequence. Only consider unhealthyPodEvictionPolicy after you understand which pods the budget is counting.
Leftover PDBs from earlier releases
PDBs often outlive the deployments they protected, or were copied from a previous chart and never updated. A budget whose selector matches no pods, or matches pods from a retired release, can still block eviction in unexpected ways. Compare each PDB's selector labels with live pods and remove budgets that protect nothing, after recording them in change control. Review budgets as part of every upgrade, since Kubernetes API changes can alter how older PDB objects behave.
DaemonSets and local storage during node work
Before you drain a node, sort its pods into two groups: those that can move to another node and those that are tied to this one. DaemonSet pods are the first group to set aside. A DaemonSet runs one pod per eligible node, so when the node comes back, the DaemonSet controller places a replacement there again. Draining therefore usually needs --ignore-daemonsets, because without it the drain stops on those pods. Ignoring them is safe only if each DaemonSet does a job that is fine to pause, such as log shipping or node metrics. A CNI agent or storage node plugin is different: if the node has no CNI agent, its pods will not network correctly, so confirm with the platform team what each DaemonSet on the node does before you drain.
The harder group is pods whose data lives on the node. Check every pod on the node for emptyDir volumes, hostPath mounts and local PersistentVolume objects, because the data behind these is bound to the machine and does not follow the pod. Eviction deletes the pod and its scratch space, and a local PV does not reattach elsewhere. Next, identify the stateful workloads behind those pods and ask whether another replica holds a current copy. Replication only helps if the replicas run on other nodes, have finished syncing and can take traffic. For each workload, confirm which nodes hold replicas and whether a PodDisruptionBudget protects them during the drain. A hostPath used for convenience can often be moved to a proper volume before the maintenance window.
Confirm this storage design with the team that owns it before any node in that workload is drained. That team knows the replication factor, the recovery procedure and the time a replica needs to resync, none of which the drain command reveals. If the answer is unclear, treat the node as holding unreplicated data and plan a backup or a move of the workload first. Record the list of affected pods and owners in the change ticket so the person returning the node to service knows what to expect and what to check.
How to drain a node for maintenance step by step
This sequence moves workloads off one node in a controlled way so patching or hardware work can happen without losing service, and it ends with the node back in scheduling and reporting Ready.
Inventory the pods running on the node
The platform engineer lists every pod scheduled on the target node with kubectl get pods across all namespaces filtered by node name, and marks which pods are DaemonSet-managed, which are standalone, and which use local storage. Standalone pods are not recreated if they are evicted, so each one needs an owner or a decision before the drain starts. The step is done when the team has a written list of pods that will need attention, grouped by namespace and workload.
Check PodDisruptionBudgets and replica spread
For each workload on the node, the engineer reviews its PodDisruptionBudget with kubectl get pdb and confirms that the allowed disruptions value is at least one, and that replicas are spread across other nodes or zones so the workload keeps serving while one copy moves. A budget that allows zero disruptions, or a deployment with all replicas on this node, will block or stall the drain, so these must be resolved with the application owners first. The step is done when every affected workload has a known disruption allowance and a confirmed plan.
Cordon the node
The engineer runs kubectl cordon on the node so the scheduler stops placing new pods on it. Existing pods keep running at this point, which makes cordon a low-risk first action that can be reversed at once. The check is kubectl get nodes, where the node should show SchedulingDisabled in its status while still reporting Ready. The step is done when no new pods are being scheduled to the node and the team has confirmed this in the cluster output.
Drain the node with the chosen flags
The engineer runs kubectl drain against the node with flags chosen in advance, such as ignoring DaemonSet-managed pods and setting a timeout, and decides on emptyDir handling only after reviewing the inventory from the first step. Drain respects PodDisruptionBudgets, so it will wait or report errors rather than break them, and any standalone pod or local-storage pod must be handled deliberately. The check is that drain completes and kubectl get pods on the node shows only DaemonSet pods. The step is done when the node is empty of workload pods and the output has been saved.
Perform the maintenance work
The operator or hardware team carries out patching, firmware or hardware work on the drained node, following the change record and any vendor steps. Power, reboot and kubelet operations happen only after the node is empty, and the node's status should be monitored so the team knows whether it has gone NotReady during the work. The step is done when the change is complete and the operator has confirmed the host is ready for the cluster to use it again.
Uncordon the node
The engineer runs kubectl uncordon on the node, which removes the scheduling block so new pods can be placed there. Uncordon does not move existing pods back, so the cluster will rebalance only as workloads are rescheduled or redeployed. The check is that the node no longer shows SchedulingDisabled. The step is done when the scheduler is allowed to use the node again and the change is recorded.
Verify pods return and the node reports Ready
The engineer confirms with kubectl get nodes that the node reports Ready, checks kubectl describe node for conditions such as pressure or network errors, and reviews kubectl get pods to confirm that DaemonSet pods are running and that drained workloads have been rescheduled and are healthy. Application health checks and any dashboards the team uses should show normal service before the change is closed. The step is done when the node is Ready, its pods are running, and the workloads that were moved are serving traffic as they did before.
Rehearse in non-production and record the run
Before doing this on production, the team runs the same sequence in a non-production cluster that mirrors the relevant workloads, PodDisruptionBudgets and storage, and notes any blocked drains, unexpected pods or timing surprises. For every production run, the engineer records the exact commands and flags used, the inventory, the drain output, the maintenance outcome and the verification results in the change record. Ask the cluster owner to confirm which flags and timeouts are approved for production, because those settings should match the team's standards rather than defaults.
Drain decision path from cordon to return to service
The path starts with cordoning the node so no new pods land on it, then inventories the pods that will be evicted, including DaemonSet pods, pods with local storage and pods behind a PodDisruptionBudget. The drain attempt is the decision point: if a PodDisruptionBudget blocks eviction, the branch returns to fixing replica counts or budgets before retrying, rather than forcing the drain. Once the drain succeeds, maintenance runs, then uncordon and verification confirm the node is Ready and workloads are scheduling again.
Decision path for draining a node, including the blocked-eviction loop.
Security and operational risks during node drains
A drain moves workloads, changes scheduling and touches every namespace the node hosts, so it carries security and availability risk beyond the node itself. The cards below cover who may run drains, what they can reach, what leaves a record and what happens to capacity while a node is out of service.
Limit who can cordon and drain
Cordoning and draining are cluster-scoped actions on Node objects and the Pod eviction subresource, so a principal with those permissions can disrupt workloads in every namespace. Create a narrow ClusterRole for node maintenance that grants patch on nodes and create on pods/eviction, and bind it to a named maintenance group rather than to cluster administrators. Check with kubectl auth can-i which identities can perform these actions today.
Avoid drains under broad admin credentials
Running a drain from a cluster-admin kubeconfig, often a long-lived one copied to a jump host, gives the operator the ability to read Secrets and change every workload along with the drain. Use short-lived, individually authenticated sessions for maintenance and keep the admin kubeconfig off shared workstations. Confirm how your identity provider issues tokens and how quickly they expire before you rely on them for patch windows.
Protect local and unmanaged data
Pods that use emptyDir or hostPath volumes lose that data when they move, and drain refuses to evict pods without a controller unless forced. Using --delete-emptydir-data or --force in a routine runbook accepts that loss silently. Inventory the node's local volumes and unmanaged pods first, and require the owning team to confirm backups or migration before the flags are used.
Keep an audit trail of drain actions
A drain is a sequence of API calls that cordon the node, evict pods and change scheduling, and it should appear in the API server audit log with the identity that made each call. Confirm that audit logging is enabled with a policy that records requests to nodes and pod evictions, and that the logs are shipped off the node. Record the ticket, operator and reason for each drain so the trail explains why workloads moved.
Watch capacity during peak load
Draining a node removes its capacity and forces replicas onto the remaining nodes, which can leave services under-provisioned or unable to schedule during peak hours. Confirm the spare capacity of the remaining nodes against the expected load before the drain and choose a window that matches your traffic pattern. Check that each critical Deployment has enough replicas to keep serving with one node gone.
Guard against stuck or blocked drains
A PodDisruptionBudget can stop evictions that would drop a workload below its minimum, which leaves the node partly drained and unclear to the operator. Review every PodDisruptionBudget that matches pods on the node before the window opens, and agree who may override a blocked drain. Overriding a PDB by hand is a risk decision that should be recorded in the same audit trail as the drain.
Questions teams ask before draining nodes
Can our own platform team drain Kubernetes nodes safely without a partner?
Yes, many teams do. Cordon and drain are standard kubectl operations, and the work becomes manageable once you know which workloads can be moved and which will block progress. The harder part is the surrounding discipline: knowing which pods run on each node, which PodDisruptionBudgets will refuse evictions, which DaemonSets and local volumes need special handling, and how to confirm each node returns healthy. A partner is most useful when the cluster is large, the change window is tight, or the team has not yet rehearsed the procedure. Confirm your team's capacity to run a rehearsal on a non-production cluster before the first real maintenance window.
What drives the effort and cost of an outside partner for node drains?
Cost follows the written scope, not the drain command itself. The main drivers are the number of clusters and nodes in scope, how many distinct workload types run on them, whether stateful workloads and local storage are involved, how many PodDisruptionBudgets need review, and whether the work is a one-time maintenance cycle or a recurring runbook. Ask for a quote that lists the deliverables separately: a node inventory and drain plan, a rehearsal on a non-production cluster, the runbook for each maintenance cycle, and any retest or follow-up support. Recurring work such as patch cycles is usually priced differently from a one-time procedure build, so ask which parts recur.
How long does a drain window take, and what does it depend on?
The duration depends on workload and spare capacity more than on the drain command. Each node must have room elsewhere in the cluster for its pods to reschedule, and each pod must start and pass readiness checks before the next one can safely move. Stateful workloads, slow-starting applications and tight PodDisruptionBudgets all lengthen the window. Measure a rehearsal on a non-production cluster to get a real figure for your environment. Do not plan around a duration from another organization's cluster, because capacity, image sizes and application startup times differ widely.
What do we need to provide before maintenance work can start?
Expect to provide four things: an inventory of nodes, workloads and their owners, approved change windows, and access that lets the engineers run kubectl with the right permissions. The inventory should list node pools, labels, taints, the pods on each node, and any DaemonSets or pods using local storage. Change windows must be agreed with the teams that own each application, because a drain can briefly reduce capacity. Access should be scoped to the clusters in the engagement, with audit logging enabled. Confirm with your security team how temporary credentials will be issued and revoked.
Why do PodDisruptionBudgets block node drains, and when should we get help?
A PodDisruptionBudget tells the eviction API how many pods of an application must stay available, so a drain stops when an eviction would break that limit. This is intended behavior, but it can stall maintenance when a budget is set too strictly, when replicas are unevenly spread, or when a single replica is the only copy. Bring in help when the same budget blocks repeated drains, when fixing it means changing application replica counts or topology, or when the workload is stateful. Those decisions affect application availability, so involve the application owners before anyone edits a budget to force progress.
How do local storage and DaemonSets affect a node drain?
Drain refuses to evict pods that use emptyDir or other local data unless you explicitly allow it, and it skips DaemonSet pods because those are expected to run on every node. Ignoring local data can destroy state that the application depends on, so review each case before using the override flags. For persistent volumes backed by network storage, check how the CSI driver detaches and reattaches volumes during reschedule. For local volumes tied to one node, the data does not move, so plan a restore or a replica elsewhere first. Ask your storage owner to confirm the backup status of each affected volume before the window opens.
Which Kubernetes version rules apply when we patch nodes in stages?
Kubelets may be up to three minor versions older than kube-apiserver, according to the Kubernetes version skew policy, so a staged node patch can run while the control plane is on a newer minor version. Check that the kubelet version you are returning to service is inside that range. Control plane components must be upgraded one minor version at a time, with kube-apiserver first. Keep node maintenance separate from control plane upgrades where possible, and read the version skew policy before scheduling both in the same period.
How do we confirm a node is safe to return to service?
A node is ready for work when the kubelet reports Ready, the node is uncordoned, the expected DaemonSet pods are running, and workloads rebalance without failing readiness checks. Build this into the runbook as explicit checks rather than relying on the absence of errors. Verify that node labels and taints are intact, that local storage is attached if it was expected, and that monitoring shows the node reporting metrics. Record the results in your change ticket so auditors and on-call engineers can see what was verified.
How DeployOpen scopes node maintenance work
DeployOpen scopes node maintenance as a fixed-scope engagement with the work, deliverables and exclusions agreed in writing before any node is cordoned. The starting point is an inventory of what runs on the nodes in question: which workloads are Deployments, StatefulSets or bare Pods, which DaemonSets must keep running, which Pods use emptyDir or other node-local volumes, and which PodDisruptionBudget objects exist and what their minAvailable or maxUnavailable values allow. A PDB that permits zero voluntary disruptions will stall a drain, and the review should identify those objects before the maintenance window rather than during it.
The review also covers replica and storage layout. Replicas need to be spread across nodes and, where the cluster spans zones, across failure domains, so that draining one node leaves enough capacity elsewhere to reschedule its Pods. For storage-backed workloads, the team confirms whether the CSI driver supports the attach and detach behavior the drain depends on, and whether recent backups exist for any database that will be restarted. Each finding becomes a change item with an owner, so the client decides which PDB or replica adjustments to accept before work begins. Ask for the exact list of findings and the owner of each one in any quote.
The output is a runbook for the maintenance window and, if requested, a retainer for recurring patching support. The runbook lists the node order, the kubectl drain flags chosen for each class of workload, the verification steps after each node returns (node Ready status, Pods rescheduled, DaemonSet Pods running, kubectl uncordon completed), and the rollback path if a drain blocks. Retainers cover the recurring work of repeating this review as workloads change and as the cluster moves through its Kubernetes version skew policy upgrades. Confirm with DeployOpen which of these items are included in your written scope and which are priced separately.

