OpenShift API for Data Protection (OADP) restore use case
Following is a use case for using OADP to restore a backup to a different namespace.
Restoring an application to a different namespace using OADP
Restore a backup of an application by using OADP to a new target namespace, test-restore-application. To restore a backup, you create a restore custom resource (CR) as shown in the following example. In the restore CR, the source namespace refers to the application namespace that you included in the backup. You then verify the restore by changing your project to the new restored namespace and verifying the resources.
Prerequisites
- You installed the OADP Operator.
- You have the backup of an application to be restored.
Procedure
-
Create a restore CR as shown in the following example:
apiVersion: velero.io/v1kind: Restoremetadata:name: test-restorenamespace: openshift-adpspec:backupName: <backup_name>restorePVs: truenamespaceMapping:<application_namespace>: test-restore-applicationwhere:
test-restore- Specifies the name of the restore CR.
<backup_name>- Specifies the name of the backup.
<application_namespace>- Specifies the target namespace to restore to.
namespaceMappingmaps the source application namespace to the target application namespace.test-restore-applicationis the name of target namespace where you want to restore the backup.
-
Apply the restore CR by running the following command:
$ oc apply -f <restore_cr_filename>
Verification
-
Verify that the restore is in the
Completedphase by running the following command:$ oc describe restores.velero.io <restore_name> -n openshift-adp -
Change to the restored namespace
test-restore-applicationby running the following command:$ oc project test-restore-application -
Verify the restored resources such as persistent volume claim (pvc), service (svc), deployment, secret, and config map by running the following command:
$ oc get pvc,svc,deployment,secret,configmapExample outputNAME STATUS VOLUMEpersistentvolumeclaim/mysql Bound pvc-9b3583db-...-14b86NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEservice/mysql ClusterIP 172....157 <none> 3306/TCP 2m56sservice/todolist ClusterIP 172.....15 <none> 8000/TCP 2m56sNAME READY UP-TO-DATE AVAILABLE AGEdeployment.apps/mysql 0/1 1 0 2m55sNAME TYPE DATA AGEsecret/builder-dockercfg-6bfmd kubernetes.io/dockercfg 1 2m57ssecret/default-dockercfg-hz9kz kubernetes.io/dockercfg 1 2m57ssecret/deployer-dockercfg-86cvd kubernetes.io/dockercfg 1 2m57ssecret/mysql-persistent-sa-dockercfg-rgp9b kubernetes.io/dockercfg 1 2m57sNAME DATA AGEconfigmap/kube-root-ca.crt 1 2m57sconfigmap/openshift-service-ca.crt 1 2m57s