Velero Backup and Restore using Replicated PV Mayastor Snapshots - Raw Block Volumes
Using Velero for backup and restore operations with Replicated PV Mayastor snapshots combines the strengths of both tools, providing a robust, efficient, and easy-to-manage solution for protecting your Kubernetes applications and data. The integration leverages the high performance and efficiency of Replicated PV Mayastor snapshots with the comprehensive backup capabilities of Velero, ensuring your data is always protected and recoverable.
Velero can support any volume provider that has a Container Storage Interface (CSI) driver with snapshotting capability.
In this guide, we will utilize Velero to create a backup of a sample Nginx application with a Replicated PV Mayastor from a cluster, transfer the backup to an object store, and restore it on a different cluster.
#
Requirements#
Replicated PV MayastorReplicated PV Mayastor CSI supports volume snapshots, which are essential for backup and recovery operations. By using Velero with Replicated PV Mayastor CSI, you can take advantage of Velero's robust backup and restore capabilities to create point-in-time snapshots of your volumes. This is critical for disaster recovery and data protection strategies.
Make sure that Replicated PV Mayastor has been installed, pools have been configured, and applications have been deployed before proceeding to the next step. Refer to the OpenEBS Installation Documentation for more details.
#
Velero with CSI Snapshot SupportVelero is an open-source tool used for backup, restore, and migration of Kubernetes cluster resources and persistent volumes. It allows users to schedule regular backups of their Kubernetes resources and persistent volumes, and to restore those resources when needed.
When CSI snapshots are enabled, Velero leverages the Kubernetes CSI driver to create snapshots of persistent volumes. These snapshots can be used to restore data to the same or different Kubernetes clusters.
#
Details of Setup#
Install Velero with CSI Snapshot Support EnabledInstall Velero (V1.13.2) with the velero-plugin-for-csi
and with any S3 object storage. In this example, we are using the Google cloud bucket as our BackupStorageLocation. Refer to Velero Documentation for instructions on setting up the BackupStorageLocation.
As an example we will be using Google Cloud Platform (GCP) and OpenEBS.
- Install Velero with a privileged node agent by utilizing the
--privileged-node-agent
to take raw block volume backups.
- Once you have installed Velero, verify that Velero has installed correctly.
Command
Output
- Verify the backup and snapshot storage location.
Use the following command to verify the backup:
Command
Output
Use the following command to verify the snapshot storage location:
Command
Output
#
Deploy the Application with CSI Backed VolumesBefore installing the application with CSI backed volumes, install the storage class and the volume snapshot class for the OpenEBS CSI driver by applying the below yaml to your cluster. Refer to the Replicated PV Mayastor Configuration Documentation for more details.
info
Volume snapshots for multi-replica volume are supported only from OpenEBS v4.1. The annotation velero.io/csi-volumesnapshot-class: "true"
must be added to the volume snapshot class or the Velero backup will fail.
YAML
In this example, We have deployed a sample Nginx test application (with volume mode as block) for backup and restore.
PVC with Volume Mode as Block
Mounting Raw Block Volumes to Pod
Command
Output
Command
Output
Sample Data
#
Backup using Velero- Use the following command to create a Velero backup:
Command
Output
- Use the following command to verify the backup status:
Command
Output
Command
Output
- Use the following command to verify the backup on target cluster:
Command
Output
#
Restore using Veleroimportant
In order to ensure that Velero can access the previously saved backups, it is recommended that you install Velero on the target cluster with the same values for the BUCKET-NAME and SECRET-FILENAME placeholders as you did originally. Also, make sure you have Replicated PV Mayastor already installed and that pools and storageclass have been configured.
- Use the following command to restore on target cluster:
Command
Output
note
This is being restored on the target cluster in the namespace: mayastor-app-restore-block
.
- Use the following command to verify the restore status:
Command
Ouput
Command
Output
- Use the following command to validate Nginx Application restored on target cluster:
Command
Output
Command
Output
- Validate the data on target.
Sample Data
The raw block data
has been restored to the target cluster.