Graceful Node Removal
Removing a node from a Kubernetes cluster requires careful coordination with Longhorn to ensure data availability. Simply running kubectl delete node is insufficient because Kubernetes does not automatically notify CSI storage layers to migrate data replicas before the node is destroyed.
If a node is removed without following this procedure, the replicas stored on that node will be lost, potentially leaving your volumes in a Degraded or Faulted state.
Prepare the node for removal by moving all running workloads (Pods) to other nodes. Using a timeout and force flag ensures that the drain completes even if some pods are slow to terminate or protected by Pod Disruption Budgets.
kubectl cordon <NODE_NAME>
kubectl drain <NODE_NAME> \
--ignore-daemonsets \
--delete-emptydir-data \
--force \
--grace-period=-1 \
--timeout=300s
Note: The
--grace-period=-1flag allows pods to honor their ownterminationGracePeriodSeconds. The--forceflag is necessary to remove pods that are not managed by a ReplicationController, ReplicaSet, Job, DaemonSet, or StatefulSet.
You must prevent new data from being scheduled on the node and move existing data to other healthy nodes. This can be done via the Longhorn UI or the command line.
Patch the Longhorn Node CR to disable scheduling and request eviction in a single command:
kubectl patch node.longhorn.io <NODE_NAME> \
-n longhorn-system --type=merge \
-p '{"spec":{"allowScheduling":false,"evictionRequested":true}}'
Before proceeding to delete the node, you must ensure all replicas has successfully migrated.
Via UI: In the Nodes list, watch the Replicas column for the node. Wait until the count reaches 0.
Via CLI: Poll the node status to confirm all resources (Replicas and Backing Images) have migrated:
kubectl get node.longhorn.io <NODE_NAME> -n longhorn-system -o json \
| jq '.status.diskStatus | to_entries[]
| {disk: .key,
scheduledReplicas: (.value.scheduledReplica | length),
scheduledBackingImages: (.value.scheduledBackingImage | length)}'
Note: Eviction is complete only when every disk reports
scheduledReplicas: 0andscheduledBackingImages: 0. This process works for bothAttachedandDetachedvolumes. Longhorn will automatically attach detached volumes to migrate data and detach them when finished.
Remove the node resource from the Kubernetes cluster. Longhorn requires the Kubernetes node to be removed before it will allow the deletion of the Longhorn Node resource.
kubectl delete node <NODE_NAME>
Once the Kubernetes node is deleted, the Longhorn UI will show the node in a Down state. You can now safely remove the metadata.
kubectl, you can delete the Longhorn Node resource directly using the following command:kubectl -n longhorn-system delete nodes.longhorn.io <NODE_NAME>
The UI disables the Delete button if the corresponding Kubernetes node still exists. Ensure you have successfully executed kubectl delete node <NODE_NAME> first.
If the replica count does not reach 0, check the Events log. Common causes include:
Replica Node Level Soft Anti-Affinity is disabled, and all other nodes already host a replica of the same volume, the eviction will have no valid destination. To learn more about anti-affinity and how to resolve this, see Replica Scheduling and Anti-Affinity.Faulted state. To learn more volume and volume health, refer to Volume documentation.© 2019-2026 Longhorn a Series of LF Projects, LLC. Documentation Distributed under CC-BY-4.0.
For website terms of use, trademark policy and other project policies please see lfprojects.org/policies.