Skip to main content
Version: 2.6

Backup rules for VMs

File-system consistent backups require you to freeze IO operations before backing up the volumes and unfreeze them after creation of backups. If you want to take file-system consistent backups, here are the sample values for pod selector and action field to create pre-exec and post-exec rules.

Refer Create Backup Rules to create pre-exec and post-exec rules for the VMs.

note

Action field can be fetched from Virtlauncher pod.

Here is a sample Pod Selector and Action values for pre-exec and post exec rules:

  • Pre-exec rule values for freeze

    • Pod Selector: vm.kubevirt.io/name: “<vm-name>”
    • Action: /usr/bin/virt-freezer --freeze --name <vm-name> --namespace <namespace>
  • Post-exec rule values for unfreeze/thaw

    • Pod Selector: vm.kubevirt.io/name: “<vm-name>”
    • Action: /usr/bin/virt-freezer --unfreeze --name <vm-name> --namespace <namespace>

The action for freeze/unfreeze can be fetched by describing the virt-launcher pod of the VM.

note

For every VM that you want to back up, make sure there exists a pod-selector and action specific to the VM in the pre-exec and post-exec rules.

Following illustration provides sample freeze and unfreeze pre-exec rule for a VM:

Create freeze pre-exec rule

Create unfreeze pre-exec rule

KDMP Backup and Restore with KubeVirt VMs

Consider a cluster running OpenShift 4.11 and above with KubeVirt 0.59.x. Let us assume that your KubeVirt VMs use PVCs with ReadWriteOnce (RWO) volumes and are in running state. In this environment, when the user takes a generic backup (that triggers KDMP backup), backup and restore operations complete successfully but the KubeVirt VMs state goes to indefinite paused state.

note

KDMP backups are not supported in SELinux enabled OpenShift environments.

To avoid encountering this scenario or as a workaround, make sure that you:

  1. Refrain from taking generic backups of KubeVirt VMs that are in running state that use RWO volumes.

  2. Restart the VMs in paused state using virtctl CLI or Openshift web console if KubeVirt VMs go to paused state due to the backup process, after the backup is successful.

  3. Use Portworx volumes as RWO which does not use generic backup.

  4. Set access mode for non-portworx provisioner volumes as ReadWriteMany (RWX) or ReadOnlyMany (ROX).

Was this page helpful?