Snapshot Backups with Velero¶
This method leverages Velero’s integration with Container Storage Interface (CSI) drivers to create volume snapshots, providing efficient and consistent backups for cloud-native environments.
Prerequisites¶
- Velero Installation with CSI Support
Ensure Velero is installed with CSI snapshot support enabled. This requires the EnableCSI flag during installation. For detailed instructions, refer to the official Velero documentation Container Storage Interface Snapshot Support in Velero.
- CSI Driver Installation
Confirm that a compatible CSI driver is installed and configured in your Kubernetes cluster. The CSI driver should support snapshot operations for your storage provider.
Backup process using Velero with CSI Snapshots¶
Set MSR4 to Read-Only Mode.
Before initiating the backup, set MSR4 to Read-Only mode to prevent new data from being written during the process, minimizing inconsistencies.
Log in to MSR4 as an administrator.
Navigate to Administration -> Configuration.
Under System Settings, enable the Repository Read-Only option.
Click Save to apply the changes.
Optional: Label Redis-Related Resources for Exclusion.
To avoid backing up ephemeral data, exclude Redis-related resources from the backup.
Label the Redis Pod:
kubectl -n <MSR4-NAMESPACE> label pod <REDIS-POD-NAME> velero.io/exclude-from-backup=true
Repeat the labeling process for the Redis PersistentVolumeClaim (PVC) and PersistentVolume (PV):
kubectl -n <MSR4-NAMESPACE> label pvc <REDIS-PVC-NAME> velero.io/exclude-from-backup=true kubectl -n <MSR4-NAMESPACE> label pv <REDIS-PV-NAME> velero.io/exclude-from-backup=true
Create a backup.
Create a Full Snapshot Backup (Recommended for initial backup)
Full Snapshot Backup is recommended for an initial backup.
Use the following command to backup the entire MSR4 namespace, capturing snapshots of all PersistentVolumes:
velero backup create msr4-full-backup --include-namespaces <MSR4-namespace> --snapshot-volumes --wait
Create an Incremental Snapshot Backup
After the full backup, incremental backups happen automatically. They capture only the changes since the last backup if the CSI Storage driver supports this capability. Please check with the manufacturer of your CSI driver.
When running incremental backups, use the
--from-backup
flag:velero backup create msr4-full-backup --include-namespaces <MSR4-NAMESPACE> --snapshot-volumes --wait
Note
Replace <TIMESTAMP> with the current date and time to uniquely identify each backup.
This command can be scheduled to run periodically.
Restore process¶
To restore MSR4 from a snapshot backup, follow these steps:
Restore a Full Backup
Set MSR4 to Read-Only Mode.
Log in to MSR4 as an administrator.
Navigate to Administration -> Configuration.
Under System Settings, enable the Repository Read-Only option.
Click Save to apply the changes.
Run the restore command.
Restore from the most recent backup:
velero restore create msr4-restore --from-backup msr4-full-backup --wait
Restore an Incremental Backup
Set MSR4 to Read-Only Mode.
Log in to MSR4 as an administrator.
Navigate to Administration -> Configuration.
Under System Settings, enable the Repository Read-Only option.
Click Save to apply the changes.
Run the restore command.
Restore from the most recent backup:
velero restore create msr4-restore-incremental --from-backup msr4-incremental-backup --wait
Complete backup by unsetting Read-Only mode¶
After the backup is complete, revert MSR4 to its normal operational state:
Navigate to Administration -> Configuration.
Under System Settings, disable the Repository Read-Only option by unchecking it.
Click Save to apply the changes.