VM Migration and Recovery from a Node Failure

There are two different node events, and they require different procedures:

  • For planned maintenance, first cordon the node and live-migrate its VMs while it is still healthy. Follow KubeVirt Node Maintenance.
  • For an unexpected node failure, first fence the node. KubeVirt cannot tell a powered-off node from a temporary network partition, so recreating a VM before fencing can run two copies of the same guest.

Do not use the failure procedure for a planned drain, and do not use a planned drain to recover a node that is no longer reachable.

Planned maintenance

The node-maintenance how-to is the authoritative procedure for a graceful change window. It checks capacity and LiveMigratable=True, cordons the source node, migrates one VM at a time, and verifies the VMIM, VMI, and launcher before the node is drained. In particular, do not force-delete a launcher Pod to make the drain return successfully.

Recovery from an unexpected node failure

1. Preserve diagnostics

Record the node, VMIs, launcher Pods, and volume attachments before changing resources:

kubectl get node <failed-node> -o yaml
kubectl get vmi -A -o wide
kubectl get pod -A -l kubevirt.io=virt-launcher -o wide
kubectl get volumeattachment -o wide
kubectl get events -A --sort-by=.lastTimestamp

2. Fence the failed node

Use the approved out-of-band power isolation or the cluster's node-remediation stack (for example, the configured Node Fault Detection/Node Remediation workflow). Confirm that the old node cannot execute the guest and cannot write to its storage before recovering the VM.

Do not treat NotReady, a lost API connection, or a stale Pod phase as proof that the guest has stopped. Do not remove a virt-launcher Pod or a VolumeAttachment before fencing.

3. Run the approved remediation

After fencing, follow the remediation runbook for the installed Kubernetes, CSI, and node-remediation versions. That runbook may apply the node.kubernetes.io/out-of-service taint or remove stale resources so that volumes can detach. The exact action depends on the storage driver and must not be replaced by an unreviewed kubectl delete command.

4. Verify one replacement VMI

Wait for the VM controller to create one replacement VMI on a healthy node. Verify the VM remains in the intended running state, the new VMI is Ready, and only one active launcher exists:

kubectl get vm -A -o wide
kubectl get vmi -A -o wide
kubectl get pod -A -l kubevirt.io=virt-launcher -o wide
kubectl get volumeattachment -o wide

If a VMI remains stuck, preserve its events and condition messages and return to the fencing/remediation runbook. Do not use --force or --grace-period=0 as a first response; those options can create split-brain VMs or leave storage in an unsafe state.