Using Velero
Velero is an open-source Kubernetes cluster backup and migration tool by VMware. KubeVirt provides a Velero plugin to support virtual machine backup and restoration.
TOC
PrerequisitesOperation StepsPreparationBackupRestoreCross-Cluster RestoreRestore to a Different NamespaceRestore to a Different Storage ClassPrerequisites
- Kubernetes Version: 1.20 or higher (Velero requirement)
- S3 Storage: For Velero BackupStorageLocation, use platform-provided Ceph or MinIO object storage
- Block Storage: Platform-provided Ceph RBD
Operation Steps
Preparation
-
Deploy Velero on the ACP platform via Platform Management → Cluster Management → Backup and Recovery → Backup Repository. Use object storage details to create the backup repository.
-
Enable the CSI feature and add the KubeVirt plugin:
Add the following to the Velero deployment:
Add to the initContainers section:
-
Verify the KubeVirt plugin installation:
Example output:
-
Adjust node-agent to mount the host kubelet directory and enable privileged mode (required for data movement via
/var/lib/kubelet):Update with:
Backup
-
Create a virtual machine with multiple disks as needed.
-
Create a backup resource:
-
Wait for the backup to complete and verify:
Example output:
-
Check dataupload status for data movement:
Example output:
-
Verify backup completion:
Example output:
-
Check the backup repository (e.g., MinIO) for directories:
Example output:
Restore
-
Delete the original virtual machine.
-
Create a restore resource via Platform Management → Cluster Management → Backup and Recovery → Restore Management or manually:
-
Verify the restore:
Check datadownload status:
Example output:
Restore status:
-
Confirm the virtual machine is restored and operational.
Cross-Cluster Restore
- Deploy Velero on the new cluster and complete the preparation steps.
- Configure the same backup repository (same bucket and directory) as the original cluster. The backup resource will automatically appear.
- Follow the restore steps above.
Restore to a Different Namespace
Add a namespaceMapping field to the restore spec:
Restore to a Different Storage Class
- Create a ConfigMap in the
cpaas-systemnamespace before initiating the restore: - Ensure storage capabilities (e.g., cross-node access, RWX) are consistent.
- Note: RWX mode modification is not currently supported.