KubeVirt Node Maintenance
Use this runbook for planned maintenance of one healthy worker node. It cordons the node, asks Kubernetes to drain it, and lets KubeVirt evacuate the VMs before the node is taken out of service. A VM that can live migrate stays running throughout, although a short guest pause and additional CPU, memory, and network usage are possible. A VM that cannot live migrate is restarted on another node, so identify those before the window rather than during it.
This runbook is not a recovery procedure for a failed or partitioned node. In that case, fence the node first and follow VM Migration and Recovery from a Node Failure. Do not recreate a VM while the old node might still be running it.
Never use --force, --disable-eviction, --grace-period=0, or force-delete
a virt-launcher Pod to make a planned drain finish. These options can bypass
KubeVirt's evacuation path and interrupt the guest.
TOC
How KubeVirt handles a drainBefore the maintenance window1. Confirm worker capacity2. Confirm the eviction strategy3. List the VMs that cannot migrate4. Budget the drain against the migration limitsDrain the nodeFinish the maintenanceUnexpected node failureHow KubeVirt handles a drain
virt-launcher is a Kubernetes Pod, but the guest is a KubeVirt VMI. When the
Kubernetes Eviction API receives an eviction request for a launcher, the
virt-launcher-eviction-interceptor.kubevirt.io admission webhook marks a
migratable VMI for evacuation and denies that request with HTTP 429, so the
eviction itself never stops the guest. KubeVirt live-migrates the VMI in the
background. The eviction is allowed only after the migration has completed and
the launcher on the source node is no longer the active one. kubectl drain
performs these retries automatically, which is why a 429 during a drain is
expected progress rather than a failure.
A drain that is migrating a VM prints the interceptor's messages until the migration finishes:
The effective eviction strategy is read from the VMI first and otherwise from the KubeVirt cluster configuration:
In practice VMs become non-migratable for many reasons — RWO storage, host
devices, certain network bindings, a CPU model the destination cannot satisfy.
LiveMigrateIfPossible keeps those cases from turning a routine node
maintenance into a blocked one: the VMs that can move are migrated with no
interruption, and only the ones that genuinely cannot are restarted elsewhere.
Check the cluster-level value on an existing cluster; it may be None. The
bundle ships spec.evictionStrategy: LiveMigrateIfPossible, so a fresh install
is drain-safe. A HyperConverged created before that, or created from an empty
spec, has no explicit value — and HCO's own fallback resolves to None on
ACP, because the cluster infrastructure resource it derives the default from
does not exist on ACP clusters, leaving
hco.status.infrastructureHighlyAvailable at false even on a multi-node
cluster. On such a cluster a drain stops every VM that has no VM-level
strategy. Read the effective values with the commands in step 2 before you
schedule any maintenance, and set the cluster-level value if it is still empty
or None:
Before the maintenance window
Do this validation before scheduling the change. A drain is not a test of VM
compatibility: under LiveMigrateIfPossible a VM that cannot migrate is
restarted on another node without warning you first, and under LiveMigrate it
leaves the node undrained. Either way you want the list of non-migratable VMs
before the window, not during it.
1. Confirm worker capacity
Keep at least two Ready and schedulable worker nodes, and confirm that a
destination can satisfy each VM's CPU, memory, device, affinity, taint,
toleration, topology, and network requirements.
Do not start maintenance on two workers at once unless the capacity plan has been approved.
2. Confirm the eviction strategy
For each VMI on the node, inspect the explicit VMI/VM value. If it is empty,
inspect the installed KubeVirt configuration; do not assume a value from the
ACP release number. The HCO field is spec.evictionStrategy. Discover the
served CRD version rather than hard-coding it, so the check keeps working if a
later release serves a different version.
On ACP 4.4 the CRD is served as hco.kubevirt.io/v1beta1 and the command above
prints the None/LiveMigrate/LiveMigrateIfPossible/External enum. If
kubectl explain cannot resolve spec.evictionStrategy on the served version,
stop and update this page and its compatibility test for the installed API
version instead of guessing another field path.
An empty evictionStrategy on both the VMI and the VM means the cluster-level
value applies — which is what the bundle sets, or None on a cluster that
predates it.
Most VMs need no VM-level value: inheriting the cluster's
LiveMigrateIfPossible is the intended behavior. Set one explicitly only for a
VM whose handling must differ from the cluster's, and set it in that VM's source
of truth (GitOps manifest, form, or API) before the window. Set
runStrategy: Always when the VM must be recreated and started after an
interruption. Do not add runStrategy to a VM that still has the deprecated
spec.running field; update the source manifest and use only one of them.
The relevant part of a VM manifest is:
Keep the VM's existing domain, networks, volumes, and placement settings when applying this change. A direct patch is acceptable only when the VM is not managed by GitOps or another controller; otherwise update that source of truth.
Changing the VM template does not change an already-running VMI. If a running
VMI's effective strategy is still None, it will be stopped by the drain no
matter what the VM template now says; recreate or restart that VM during an
approved window to pick the new value up. Never patch a running VMI to force
this change.
3. List the VMs that cannot migrate
For every VMI currently on the maintenance node, read Ready and
LiveMigratable. Check that PVCs are bound and that storage, networks, devices,
CPU model, and placement rules allow a destination. Shared storage such as RWX
is common, but the LiveMigratable condition is the authoritative check for the
installed KubeVirt version.
A VMI with LiveMigratable=False will be stopped and restarted on another
node under LiveMigrateIfPossible. That is the intended trade-off — one
stubborn VM must not block node maintenance — but it is only acceptable when it
is a known, communicated restart rather than a surprise. For each such VM,
read the condition's reason and message, then decide before the window:
fix the blocker (for example move it to RWX storage), accept the restart and
tell its owner, or move the VM off the node yourself beforehand.
4. Budget the drain against the migration limits
The migration settings decide whether a drain can finish inside its timeout. KubeVirt migrates a limited number of VMs out of one node at a time, so a node with many VMs drains in waves, not in parallel:
The defaults are parallelOutboundMigrationsPerNode: 2,
parallelMigrationsPerCluster: 5, completionTimeoutPerGiB: 150, and
progressTimeout: 150. With the default of two outbound migrations per node,
draining ten VMs takes at least five waves; size --timeout accordingly, or
raise the limits in hco.spec.liveMigrationConfig for the maintenance window
and restore them afterwards. A migration that exceeds
completionTimeoutPerGiB or stalls past progressTimeout is cancelled, and
the drain then reports the VM as still present.
Drain the node
-
Record the node name, each VMI UID, and current VMI node before changing the node.
-
Cordon the healthy node. Cordon prevents new workloads from being placed on it; it does not stop existing VMs.
-
Drain with the Kubernetes Eviction API and wait for KubeVirt to migrate the VMIs. Do not manually delete launcher Pods or create a one-off eviction and treat its first 429 response as failure.
-
In separate terminals, watch the migration and the drain:
For a VM you expect to migrate, accept the move only when a matching VMIM is
Succeeded, itsstatus.migrationState.sourceNodeis the maintenance node andtargetNodeis another worker, the VMI UID is unchanged, the VMI remainsRunningandReady, and only one active launcher remains. A changed Pod name, a 429 response, or an eviction log alone is not migration evidence. An unchanged VMI UID is the decisive check: a UID that changed means the VM was recreated rather than live-migrated.Under
LiveMigrateIfPossiblea non-migratable VM produces no VMIM at all — it is evicted and recreated, so its VMI UID changes and it briefly leavesRunning. Confirm that every such VM is on your step 3 list; a VM that restarts without being on that list means the migration failed for a reason you have not accounted for, so investigate before continuing.After a migration the source launcher stays listed in a
Completedphase for a while. Filter on running Pods so this does not read as a second active launcher: -
Start OS or hardware work only after
kubectl drainreports success and no VMI or launcher Pod is assigned to the node:
If the drain times out or reports a blocked VMI, leave the node cordoned, preserve the VMIM/VMI events and conditions, and resolve the stated capacity, storage, placement, PDB, or migration-limit problem. Do not force the drain.
Finish the maintenance
After the node is healthy and Ready, make it schedulable again:
Recheck the moved VMs, their application health, and the absence of duplicate active launchers before closing the change.
Unexpected node failure
This planned procedure cannot safely recover a powered-off or partitioned node. First use the approved out-of-band fencing or node-remediation workflow, then handle stale VMI, launcher, and volume-attachment resources according to that workflow. KubeVirt must never be allowed to run two copies of a guest.