2.3 Restore
Task 2.3.1: Restoring user workload backups
In the backup lab you created a scheduled backup of all resources in namespace uptime-app-prod. Now we are going to test the restore procedure.
Warning
To keep your restore time as short as possible, make sure you read through the whole procedure, understand it and maybe even prepare all resources for the restore before deleting the project!Make sure you read above warning, then go ahead and delete the project uptime-app-prod.
Hints
oc delete project uptime-app-prod
Update your backup storage location to read-only mode (this prevents backup objects from being created or deleted in the backup storage location during the restore process):
oc patch backupstoragelocation default \
--namespace openshift-adp \
--type merge \
--patch '{"spec":{"accessMode":"ReadOnly"}}'
In order to restore a backup, we need to create a Restore object. A Restore object looks like this:
apiVersion: velero.io/v1
kind: Restore
metadata:
name: restore-uptime-app-prod
namespace: openshift-adp
spec:
backupName: "<backup-name>"
excludedResources:
- nodes
- events
- events.events.k8s.io
- backups.velero.io
- restores.velero.io
- resticrepositories.velero.io
includedNamespaces:
- '*'
Copy above Restore resource into a file on your bastion host. Replace the placeholder <backup-name> with the name of the backup you want to restore. To list your available backups:
oc -n openshift-adp get backups
Start the restore by creating the Restore object:
oc apply -f <restore-file>
After the restore has completed, your uptime app should be up and running again:
oc -n uptime-app-prod get pods
Example output:
NAME READY STATUS RESTARTS AGE
uptime-app-56df4df7d8-hnsps 1/1 Running 0 20m
uptime-app-56df4df7d8-jfkzx 1/1 Running 0 20m
When ready, revert your backup storage location to read-write mode:
oc patch backupstoragelocation default \
--namespace openshift-adp \
--type merge \
--patch '{"spec":{"accessMode":"ReadWrite"}}'