mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
94 lines
3.3 KiB
Plaintext
94 lines
3.3 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * backup_and_restore/application_backup_and_restore/oadp-use-cases/oadp-usecase-restore-different-namespace.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="oadp-usecase-restore_{context}"]
|
|
= Restoring an application to a different namespace using {oadp-short}
|
|
|
|
[role="_abstract"]
|
|
Restore a backup of an application by using {oadp-short} 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-short} Operator.
|
|
* You have the backup of an application to be restored.
|
|
|
|
.Procedure
|
|
|
|
. Create a restore CR as shown in the following example:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
apiVersion: velero.io/v1
|
|
kind: Restore
|
|
metadata:
|
|
name: test-restore
|
|
namespace: openshift-adp
|
|
spec:
|
|
backupName: <backup_name>
|
|
restorePVs: true
|
|
namespaceMapping:
|
|
<application_namespace>: test-restore-application
|
|
----
|
|
+
|
|
where:
|
|
+
|
|
`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. `namespaceMapping` maps the source application namespace to the target application namespace. `test-restore-application` is the name of target namespace where you want to restore the backup.
|
|
|
|
. Apply the restore CR by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f <restore_cr_filename>
|
|
----
|
|
|
|
.Verification
|
|
|
|
. Verify that the restore is in the `Completed` phase by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc describe restores.velero.io <restore_name> -n openshift-adp
|
|
----
|
|
|
|
. Change to the restored namespace `test-restore-application` by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ 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:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc get pvc,svc,deployment,secret,configmap
|
|
----
|
|
+
|
|
.Example output
|
|
[source,terminal]
|
|
----
|
|
NAME STATUS VOLUME
|
|
persistentvolumeclaim/mysql Bound pvc-9b3583db-...-14b86
|
|
|
|
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
|
service/mysql ClusterIP 172....157 <none> 3306/TCP 2m56s
|
|
service/todolist ClusterIP 172.....15 <none> 8000/TCP 2m56s
|
|
|
|
NAME READY UP-TO-DATE AVAILABLE AGE
|
|
deployment.apps/mysql 0/1 1 0 2m55s
|
|
|
|
NAME TYPE DATA AGE
|
|
secret/builder-dockercfg-6bfmd kubernetes.io/dockercfg 1 2m57s
|
|
secret/default-dockercfg-hz9kz kubernetes.io/dockercfg 1 2m57s
|
|
secret/deployer-dockercfg-86cvd kubernetes.io/dockercfg 1 2m57s
|
|
secret/mysql-persistent-sa-dockercfg-rgp9b kubernetes.io/dockercfg 1 2m57s
|
|
|
|
NAME DATA AGE
|
|
configmap/kube-root-ca.crt 1 2m57s
|
|
configmap/openshift-service-ca.crt 1 2m57s
|
|
----
|