You can create a snapshot of a Cloud Pak for Data instance on an external, snapshot-capable
storage device, and restore it on the same cluster.
About this task
To use this backup and restore method, you must ensure the correctness of the snapshot. Also,
only the storage that is used by the Cloud Pak for Data
deployment is included so that no other apps or data are impacted by the restore operation.
- Permissions you need for this task
- You must log on as a user with cluster administrator rights.
Best practice: You can run the commands in
this task exactly as written if you set up environment variables. For instructions, see
Setting up installation environment variables.
Ensure that you source the environment variables
before you run the commands in this task.
Procedure
-
Back up the Cloud Pak for Data instance by doing the
following steps.
- Quiesce all projects (namespaces) of the Cloud Pak for Data deployment:
cpd-cli oadp backup prehooks \
--include-namespaces=${PROJECT_CPD_INSTANCE}
If your instance is comprised of a central project and one or more tethered projects, replace the
${PROJECT_CPD_INSTANCE} environment variable with a comma separated list of
projects. For example:
--include-namespaces=cpd-instance,cpd-instance-tether1,cpd-instance-tether2
.
- Back up the Kubernetes and Red Hat®
OpenShift® metadata resources:
cpd-cli oadp backup create <backup_name> \
--include-namespaces=${PROJECT_CPD_INSTANCE} \
--exclude-resources='Event,Event.events.k8s.io' \
--snapshot-volumes=false \
--cleanup-completed-resources \
--skip-hooks \
--use-retain-pv-reclaim-policy \
--log-level=debug \
--verbose
- On the external storage device, use the storage system's custom backup logic to create
the storage snapshot, limited to all necessary volumes.
- Unquiesce the Cloud Pak for Data
deployment:
cpd-cli oadp backup posthooks \
--include-namespaces=${PROJECT_CPD_INSTANCE}
- Restore the Cloud Pak for Data instance by
doing the following steps.
- Make sure that the projects to be restored were removed from the cluster.
Tip: Due to a Velero restriction, existing resources cannot be restored in-place.
- On the external storage device, use the storage system's custom restore logic to
restore the storage snapshot, limited to all necessary volumes.
- Restore PersistentVolumes (PVs) without their data:
cpd-cli oadp restore create zen-restore-pvs \
--from-backup=<backup_name> \
--include-resources='pv' \
--restore-volumes=false \
--skip-hooks \
--log-level=debug \
--verbose
- Restore the ZenService custom resource and certificates:
cpd-cli oadp restore create zenservice-restore \
--from-backup=<backup_name> \
--include-resources='namespaces,zenservices,secrets,certificates.cert-manager.io,certificates.certmanager.k8s.io,issuers.cert-manager.io,issuers.certmanager.k8s.io' \
--skip-hooks \
--log-level=debug \
--verbose
- Restore the Kubernetes and Red Hat
OpenShift metadata resources:
cpd-cli oadp restore create zen-restore \
--from-backup=<backup_name> \
--exclude-resources='ImageTag,clients,pv' \
--restore-volumes=false \
--include-cluster-resources=true \
--skip-hooks \
--log-level=debug \
--verbose
- Unquiesce the Cloud Pak for Data
deployment:
cpd-cli oadp restore posthooks \
--include-namespaces=${PROJECT_CPD_INSTANCE}