How to backup OpenShift persistent volumes using vProtect
vProtect 3.7 (update 2) gave us the ability to protect data used by Deployments/DeploymentConfigs in OpenShift clusters. The latest version of vProtect continues the development of this functionality, enriching it with:
- backup of Ceph RBD-based persistent volumes
- possibility to authorize with a token instead of kubeconfig,
- the ability to restore to projects other than the one from which we backed up the machine. (Selected from the list),
- the ability to choose a storage class, which we will use when creating a persistent volume claim (select from the list or choose none).
But in this article we will try to backup persistent volumes used by sample DeploymentConfig with MySQL.
Before we start, please make sure your OpenShift setup is prepared for vProtect – you can find the required steps [here] Let’s add our cluster to vProtect first.
Hypervisor Managers tab
Example screen |
Adding new OpenShift cluster
In the URL, please paste the current server’s REST API URL. You can obtain it by typing oc whoami – show-server in the terminal.In the username and password fields, please provide your SSH credentials to the master node (vProtect needs to read the [kubeconfig] to see your applications.) Click save, then index the hypervisor manager.
Example screen |
Indexed OpenShift hypervisor manager
Your worker nodes will now appear as Hypervisors in vProtect. Edit them and provide your SSH credentials. Now we can perform the backup.
Example screen |
Preparing MySQL backup
Example screen |
Successful MySQL backup
Now we can proceed to restoring the backup.
Example screen |
Restore window
If the deployment already exists on the cluster, vProtect will create a new one with a generated name.
Example screen |
Restored MySQL backup
Example screen |
We have restored our data successfully. Now, what happens under the hood when we backup and restore our persistent volumes?
Before the backup starts, we optionally can pause the pods to maintain data consistency – this way we assure that nothing is modified during the backup. For Ceph RBD volumes vProtect creates snaphots and is able to do incremental backups. As a second step, vProtect creates a side pod, mounts the persistent volumes to it, then proceeds with copying the data, which is later moved to a backup destination of your choice.
During the restore process, vProtect just recreates your application from metadata files we backed up – then the data is copied back in. vProtect will require a precreated (or provisioned dynamically) available volume to do that.
Also, if you wish to rename your restored application, you can provide the name in the restored window (shown one screenshot above).
In summary, since vProtect 3.7 update 2, Storware has brought you a flexible solution to protect your OpenShift data. Your backups can be stored in multiple backup destinations and restored on any OpenShift setup – with assured data consistency and in a simple and fast way to do it