Backup and Restore
OpenEBS Local Storage (a.k.a Local Engines or Local Volumes) can be backed up and restored along with the application using Velero.
note
The following steps assume that you already have Velero with Restic integration is configured. If not, follow the Velero Documentation to proceed with install and setup of Velero. If you encounter any issues or have questions, talk to us on the #openebs channel on the Kubernetes Slack server.
#
BackupThe following steps will help you to prepare and backup the data from the volume created for the example pod (hello-local-hostpath-pod
), with the volume mount (local-storage
).
Prepare the application pod for backup. Velero uses Kubernetes labels to select the pods that need to be backed up. Velero uses annotation on the pods to determine which volumes need to be backed up. For the example pod launched above, you can inform Velero to backup by specifying the following label and annotation.
Create a Backup using Velero.
Verify that backup is successful.
On successful completion of the backup, the output of the backup describe command will show the following:
#
RestoreInstall and setup Velero, with the same provider where backups were saved. Verify that backups are accessible.
The output of should display the backups that were taken successfully.
Restore the application.
note
Local PVs are created with node affinity. As the node names will change when a new cluster is created, create the required PVC(s) prior to proceeding with restore.
Replace the path to the PVC yaml in the below commands, with the PVC that you have created.
Verify that application is restored.
Depending on the data, it may take a while to initialize the volume. On successful restore, the output of the above command should show:
Verify that data has been restored. The application pod used in this example, write periodic messages (greetings) to the volume.
The output will show that backed up data as well as new greetings that started appearing after application pod was restored.