IBM Cloud Pak foundational services backup and restore for multiple instances of foundational services
You can schedule backup and restore of foundational services by using the Red Hat OpenShift API for Data Protection (OADP) operator. Make sure that you use the stable-1.3 channel of the OADP operator.
Prerequisites
-
If you plan to restore foundational services on a new cluster and currently use an
ImageContentSourcePolicyresource, reconfigure this resource on the new cluster. For more information, see Configure the cluster. -
Set up any Amazon S3-compatible storage. For example, you can create a bucket in IBM Cloud Object Storage. For more information, see IBM Cloud Object Storage
.
-
When you add a service credential to the bucket, include the hash-based message authentication code (HMAC). For more information, see Service credentials
. From the Cloud Object Storage navigation menu, gather the following information:
-
access key id, which can be found on the Service credentials page that is associated with the bucket. -
secret access key, which can be found on the Service credentials page that is associated with the bucket. -
bucket name, which can be found on the Buckets page. -
bucket region, which can be found on the Buckets page. -
root directory name, which is the path in the bucket where you want to store the backups. -
s3 URL, which is the endpoint URL of the bucket.- The endpoint URL must start with
http://orhttps://.
- The endpoint URL must start with
-
oc access to the original (usually using oc login). Velero CLI does not yet support s390x.Backup and restore with an external database
If you use an external database for storing your Identity Management (IM) and Zen data, you are responsible for backup and restore of this data.
Backing up foundational services
Complete the following steps to back up the installed foundational services.
Create the backup resources
You need the following resources for completing the backup procedures.
-
Log in to your OpenShift cluster command-line interface (CLI) by using the
oc logincommand. -
Create a namespace for Velero objects. The following example creates the
veleronamespace. For more information about Velero, see Velero documentation.
oc project velero -
Install the Red Hat OADP operator in the
veleronamespace. For more information, see About installing OADP.
-
Create a secret named
cloud-credentialswith theaccess key idandsecret access keycredentials.-
Open any editor and place the following credentials in a file named
credentials-velero.vi credentials-velero -
Insert the following content in the file:
[default] aws_access_key_id=<access_key_id> aws_secret_access_key=<secret_access_key> -
Create the secret.
oc create secret generic cloud-credentials -n velero --from-file cloud=credentials-velero
-
-
From your OpenShift cluster console OperatorHub page, install the OADP operator from the
stable-1.3channel, which provides the Velero 1.9 API. The API is needed for foundational services backup and restore. For more information, see OpenShift Container Platform documentation.
-
Create a
DataProtectionApplicationobject.Note: Theproviderisawseven if you are not using AWS Object Storage.If you use Red Hat® OpenShift® Container Platform version 4.19 and onward, use the following
DataProtectionApplicationcustom resource (CR).apiVersion: oadp.openshift.io/v1alpha1 kind: DataProtectionApplication metadata: name: <resource_name> namespace: velero annotations: argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true argocd.argoproj.io/sync-wave: '20' spec: backupLocations: - velero: config: profile: default region: <bucket_region> s3ForcePathStyle: 'true' s3Url: <s3_URL> credential: key: cloud name: cloud-credentials default: true objectStorage: bucket: <bucket_name> prefix: <root_directory_name> provider: aws configuration: nodeAgent: enable: true uploaderType: kopia velero: defaultPlugins: - openshift - aws podConfig: resourceAllocations: limits: cpu: '1' memory: 1Gi requests: cpu: 500m memory: 512MiIf you use a version of OpenShift Container Platform before version 4.19, use the following
DataProtectionApplicationCR.apiVersion: oadp.openshift.io/v1alpha1 kind: DataProtectionApplication metadata: name: <resource_name> namespace: velero annotations: argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true argocd.argoproj.io/sync-wave: '20' spec: backupLocations: - velero: config: profile: default region: <bucket_region> s3ForcePathStyle: 'true' s3Url: <s3_URL> credential: key: cloud name: cloud-credentials default: true objectStorage: bucket: <bucket_name> prefix: <root_directory_name> provider: aws configuration: restic: enable: true velero: defaultPlugins: - openshift - aws podConfig: resourceAllocations: limits: cpu: '1' memory: 1Gi requests: cpu: 500m memory: 512Mi
Add labels to resources
You can add labels to resources automatically by running the script or by manually adding labels. Complete one of the following procedures.
Labelling the resources automatically by running the script
-
Run the following commands to fetch and download the
env.propertiesfile and thelabel-common-services.shscript and save them in the same folder.wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/backup/common-service/label-common-service.sh wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/backup/common-service/env.properties -
Open the
env.propertiesfile, edit the required variables and save the changes.Note: TheOPERATOR_NS=""variable must be properly set for the script to work. Other variables have default values. You can change these values to fit your environment.vi env.propertiesThe
env.propertiesfile contains the following variables:# Change the following values to match your environment OPERATOR_NS="" # Pass the namespace where the cs operator is installed # Pass the namespace where the cs services are installed # Leave it as empty string if the services are installed in the same namespace as the operator SERVICES_NS="" CONTROL_NS="" # Pass the control namespace if it is needed to be backed up #Pass any additional namespaces in the tenant that are not the operator or services namespace. Comma delimited TETHERED_NS="" # Change to the namespace where cert-manager, licensing and LSR are installed CERT_MANAGER_NAMESPACE="ibm-cert-manager" LICENSING_NAMESPACE="ibm-licensing" LSR_NAMESPACE="ibm-lsr" # enable labeling of cert manager, licensing, and LSR resources by changing value to 1 ENABLE_CERT_MANAGER=0 ENABLE_LICENSING=0 ENABLE_LSR=0 # Change to 1 to enable private catalog ENABLE_PRIVATE_CATALOG=0 #change to 1 to label catalog sources in openshift-marketplace ENABLE_DEFAULT_CS=0 # Add additional CatalogSources separated by comma which are withour ".spec.publisher: IBM" # For example: "my-catalog,my-catalog2,my-catalog3" ADDITIONAL_SOURCES="" -
Use the following command to run the
label-common-service.shscript../label-common-service.sh -
Add labels to the Licensing service configmaps:
-
Find the licensing namespace:
oc get pods -A | grep licensing -
Get the
label-licensing-configmaps.shfile.wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/backup/licensing/label-licensing-configmaps.sh -
Add executable permission.
chmod +x label-licensing-configmaps.sh -
Run the script.
./label-licensing-configmaps.sh <namespace from previous step>
-
-
Add labels to the Cert Manager resources:
- Get the
label-cert-manager.shfile.wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/backup/cert-manager/label-cert-manager.sh - Add executable permission.
chmod +x label-cert-manager.sh - Run the script.
./label-cert-manager.sh
Note: Thelabel-cert-manager.shscript searches all namespaces for cert manager resources. The search might require elevated privileges to run. - Get the
Manually adding labels to resources
Before you begin, set the namespace where you installed foundational services as the default namespace.
oc project <namespace-where-foundational services-are-installed>
You must label the resources that are currently installed to identify them during restoration.
-
If you use IBM License Service Reporter, see Backing up the License Service Reporter instance.
-
Add a label to the catalog sources. The following are common catalogsources that are used by IBM Cloud Paks:
oc label catalogsource ibm-operator-catalog foundationservices.cloudpak.ibm.com=catalog -n openshift-marketplace --overwrite=true oc label catalogsource opencloud-operators foundationservices.cloudpak.ibm.com=catalog -n openshift-marketplace --overwrite=true oc label catalogsource ibm-cert-manager-catalog foundationservices.cloudpak.ibm.com=catalog -n openshift-marketplace --overwrite=true oc label catalogsource ibm-licensing-catalog foundationservices.cloudpak.ibm.com=catalog -n openshift-marketplace --overwrite=true oc label catalogsource cloud-native-postgresql-catalog foundationservices.cloudpak.ibm.com=catalog -n openshift-marketplace --overwrite=trueIf you installed the
ibm-user-mgmt-operatoroperator, label the following catalog sources:oc label catalogsource ibm-redis-cp-operator-catalog foundationservices.cloudpak.ibm.com=catalog -n openshift-marketplace --overwrite=true oc label catalogsource ibm-user-management-operator-catalog foundationservices.cloudpak.ibm.com=catalog -n openshift-marketplace --overwrite=trueA running cluster might have different catalog sources than those listed in the preceding command. In that case, the following instructions can help determine which other catalog sources to label:
- List all available catalog sources:
oc get catalogsource -A - Determine which catalog sources to label with
foundationservices.cloudpak.ibm.com=catalog. Label any catalog source withIBMunder thePUBLISHERcolumn.
Note: Some of the preceding catalog sources might not be in use. Catalog sources might be located in a namespace other than openshift-marketplace in which case the namespace parameter would need to be updated in the preceding command. - List all available catalog sources:
-
Add a label to the common-service-maps configmap in the kube-public namespace (if present):
oc label configmap common-service-maps -n kube-public foundationservices.cloudpak.ibm.com=configmap --overwrite=true -
If using a custom hostname, custom TLS secret, or both, label the
common-web-ui-configconfigmap in each namespace it is present:oc label configmap common-web-ui-config foundationservices.cloudpak.ibm.com=configmap --overwrite=true -n <namespace present>This configmap can be found by using the command:
oc get cm -A | grep common-web-ui-config -
If using a custom hostname, custom TLS secret, or both, label the
cs-onprem-tenant-configconfigmap in each namespace it is present:oc label configmap cs-onprem-tenant-config foundationservices.cloudpak.ibm.com=configmap --overwrite=true -n <namespace present>This configmap can be found by using the command:
oc get cm -A | grep cs-onprem-tenant-config -
Add a label to the namespaces where you installed foundational services, the namespace where IBM Cert Manager is installed (default namespace is
ibm-cert-manager), the namespace where IBM Licensing is installed (default namespace isibm-licensing), and workload namespaces that use foundational services. It is possible there are multiple namespaces with foundational services installed. Make sure to label each of them.-
Find the namespaces where the services are installed.
- Find the namespace where IBM Cert Manager is installed:
oc get pods -A | grep cert-manager - Find the namespace where IBM Licensing is installed:
oc get pods -A | grep licensing - Determine the workload namespaces. First, check whether the
common-service-mapsconfigmap exists:
If it exists, make sure to label each namespace listed underoc get cm common-service-maps -n kube-publicrequested-from-namespace,map-to-common-service-namespace, andcontrolNamespacevalues:
If the common-service-maps configmap is not present, label each namespace that is using the common service instances for smoother restoration process.oc get cm common-service-maps -n kube-public -o yaml
- Find the namespace where IBM Cert Manager is installed:
-
Label the namespaces.
oc label namespace <namespace-where-foundational services-is-installed> foundationservices.cloudpak.ibm.com=namespace --overwrite=true oc label namespace <namespace-where-cert-manager-is-installed> foundationservices.cloudpak.ibm.com=namespace --overwrite=true oc label namespace <namespace-where-licensing-is-installed> foundationservices.cloudpak.ibm.com=namespace --overwrite=true oc label namespace <requested-from-namespace> foundationservices.cloudpak.ibm.com=namespace --overwrite=true oc label namespace <controlNamespace> foundationservices.cloudpak.ibm.com=namespace --overwrite=true
-
-
Add a label to the operator group:
- Get the names of the operator groups:
oc get operatorgroup -A - Add a label to each operator group labeled
common-service,ibm-cert-manager-operator, oribm-licensing-operator-app.oc label operatorgroup <operatorgroup-name> foundationservices.cloudpak.ibm.com=operatorgroup --overwrite=true -n <namespace>
There might be more IBM Cloud Pak specific operator groups to label as well.
- Get the names of the operator groups:
-
Add a label to the IBM Common Service Operator subscription, there is one in each namespace where the
ibm-common-service-operatorpod is deployed:-
Determine the subscription name:
oc get subscriptions.operators.coreos.com -n <namespace> | grep ibm-common-service-operator -
Label the subscription:
oc label subscriptions.operators.coreos.com <ibm common service operator subscription name> foundationservices.cloudpak.ibm.com=subscription --overwrite=true -n <namespace>
-
-
Add a label to the IBM Cert Manager Operator subscription:
-
Check the certificate manager service that is installed in the cluster. If IBM Cert Manager is installed in your cluster, the pod name has
ibm-cert-manager-operatorin it.oc get pods -A | grep cert-managerNote: If the cert manager operator pod is named something other thanibm-cert-manager-operator-<alphanumeric characters>, it means that a third-party certificate manager service is installed. Make sure to install this third-party cert manager on the target restore cluster before you restore subscriptions. -
Determine the subscription name:
oc get subscriptions.operators.coreos.com -n <namespace> | grep ibm-cert-manager-operator -
Label the subscription:
oc label subscriptions.operators.coreos.com ibm-cert-manager-operator foundationservices.cloudpak.ibm.com=singleton-subscription --overwrite=true -n <namespace where cert manager is deployed>
-
-
Add a label to the IBM Licensing Operator subscription:
- Refer to the label licensing in the preceding step to find the namespace or use the following:
oc get pods -A | grep ibm-licensing - Determine the subscription name:
oc get subscriptions.operators.coreos.com -n <namespace> | grep ibm-licensing-operator - Label the subscription:
oc label subscriptions.operators.coreos.com <IBM licensing subscription name> foundationservices.cloudpak.ibm.com=singleton-subscription --overwrite=true -n <namespace>
- Refer to the label licensing in the preceding step to find the namespace or use the following:
-
Add a label to the
common-serviceCR:oc label commonservices common-service foundationservices.cloudpak.ibm.com=commonservice --overwrite=true -n <namespace>Note: This needs to be done for each instance ofCommonServiceCR on the cluster. There is one for each instance of foundational services. There are two if using SOD; one in the operator namespace and one in the services namespace. Label both custom resources. -
Add a label to the
commonservices.operator.ibm.comcustomresourcedefinition (CRD):oc label customresourcedefinition commonservices.operator.ibm.com foundationservices.cloudpak.ibm.com=crd --overwrite=true -
Add a label to the entitlement secret, if you have one in your cluster:
- Find all entitlement keys on the cluster:
oc get secret -A | grep ibm-entitlement-key - Label each entitlement key:
oc label secret ibm-entitlement-key foundationservices.cloudpak.ibm.com=entitlementkey --overwrite=true -n <namespace>
- Find all entitlement keys on the cluster:
-
Add a label to the global pull secret, if you have one in your cluster:
oc label secret pull-secret -n openshift-config foundationservices.cloudpak.ibm.com=pull-secret --overwrite=true -
If you installed the
ibm-user-mgmt-operatoroperator, add a label to theuser-mgmt-bootstrapsecret:label secret user-mgmt-bootstrap foundationservices.cloudpak.ibm.com=cert-manager -n <namespace> -
Add a label to the OperandRequests:
- Find operand requests to label:
oc get operandrequests -A - Label each OperandRequest:
oc label operandrequests <operand request name> foundationservices.cloudpak.ibm.com=operand --overwrite=true -n <namespace>
Note: Typically, foundational services OperandRequests are namedcommon-serviceso any OperandRequest with this name should be labeled. However, there might be more OperandRequests to label besides ones that are namedcommon-serviceas Cloud Paks might name their OperandRequests something different. There are some that do not need to be labeled because they are created automatically when certain services are requested such asibm-iam-request. There is no harm in labeling this request. - Find operand requests to label:
-
Label the
namespacescopeCRD and CR:Note: The following steps provide instructions for labelling thenamespacescoperesources, such as thenamespacescopeCR, subscription, service account, and ConfigMap. If you have more than one instance of foundational services installed on the cluster, label these resources for each operator.oc label namespacescope common-service -n <operator namespace> foundationservices.cloudpak.ibm.com=nss --overwrite=true oc label customresourcedefinition namespacescopes.operator.ibm.com foundationservices.cloudpak.ibm.com=nss --overwrite=true -
Label the
namespacescopesubscription:oc label subscriptions.operators.coreos.com ibm-namespace-scope-operator -n <operator namespace> foundationservices.cloudpak.ibm.com=nss --overwrite=true -
Label the
namespacescopeConfigMap:oc label configmap namespace-scope -n <operator namespace> foundationservices.cloudpak.ibm.com=nss --overwrite=true -
Label the namespacescope service account:
oc label serviceaccount ibm-namespace-scope-operator -n <operator namespace> foundationservices.cloudpak.ibm.com=nss --overwrite=true -
Label the
namespacescoperoles across namespaces:-
Run the following command to find all roles:
oc get role -A | grep nss-managed-role-from -
Label each role that is returned:
oc label role <role name> -n <namespace where role is present> foundationservices.cloudpak.ibm.com=nss --overwrite=true
-
-
Label the
namespacescoperole bindings across namespaces:-
Run the following command to find all role bindings:
oc get rolebinding -A | grep nss-managed-role-from -
Label each role binding that is returned:
oc label rolebinding <rolebinding name> -n <namespace where rolebinding is present> foundationservices.cloudpak.ibm.com=nss --overwrite=true
-
-
Add the
foundationservices.cloudpak.ibm.com=nsslabel to the following resources:- `subscriptions.operators.coreos.com ibm-namespace-scope-operator` in the operator namespace: ```cmd {: codeblock} oc label subscriptions.operators.coreos.com ibm-namespace-scope-operator foundationservices.cloudpak.ibm.com=nss -n <operator namespace> ```-
namespacescopes.operator.ibm.com common-servicein the operator namespace:oc label namespacescopes.operator.ibm.com common-service foundationservices.cloudpak.ibm.com=nss -n <operator namespace> -
customresourcedefinition namespacescopes.operator.ibm.com:oc label customresourcedefinition namespacescopes.operator.ibm.com foundationservices.cloudpak.ibm.com=nss -n <operator namespace> -
serviceaccount ibm-namespace-scope-operatorin the operator namespace:oc label serviceaccount ibm-namespace-scope-operator foundationservices.cloudpak.ibm.com=nss -n <operator namespace> -
role nss-managed-role-from-<operator namespace>in the operator, services, and all tethered namespaces:oc label role nss-managed-role-from-<operator namespace> foundationservices.cloudpak.ibm.com=nss -n <operator namespace> -
rolebinding nss-managed-role-from-<operator namespace>in the operator, services, and all tethered namespaces:oc label rolebinding nss-managed-role-from-<operator namespace> foundationservices.cloudpak.ibm.com=nss -n <operator namespace> -
configmap namespace-scopein the operator namespace:oc label configmap namespace-scope foundationservices.cloudpak.ibm.com=nss -n <operator namespace>
Tip: You can find the role and role bindings to label by running the following command:
oc get <role/rolebinding> -A | grep nss-managed-role-from-<operator namespace>. Label all resources that you get in response. -
Backup common-service-db
-
Get the common-service-db backup resources.
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/common-service-db/cs-db-backup-deployment.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/common-service-db/cs-db-backup-pvc.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/common-service-db/cs-db-br-script-cm-4.6.10.4.11.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/common-service-db/cs-db-role.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/common-service-db/cs-db-rolebinding.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/common-service-db/cs-db-sa.yamlIf you use foundational services version 4.19.0 or later, use the following paths instead:
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/ibm-pg/common-service-db/cs-db-backup-deployment.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/ibm-pg/common-service-db/cs-db-backup-pvc.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/ibm-pg/common-service-db/cs-db-br-script-cm.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/ibm-pg/common-service-db/cs-db-role.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/ibm-pg/common-service-db/cs-db-rolebinding.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/ibm-pg/common-service-db/cs-db-sa.yaml -
Update the backup files.
- Replace
<cs-db namespace>with the namespace where common-service-db instance is running. - Replace the
<storage class>with the storage class that the current IM deployment uses.
- Replace
-
Add the PVC to the cluster.
oc apply -f cs-db-backup-pvc.yaml -
Add the
cs-db-br-script-cm-4.6.10.4.11.yamlto the correct namespace:oc apply -f cs-db-br-script-cm-4.6.10.4.11.yamlIf you use foundational services version 4.19.0 or later, add the
cs-db-br-script-cm.yamlto the correct namespace:oc apply -f cs-db-br-script-cm.yaml -
Give the common-service-db backup necessary permissions
oc apply -f cs-db-sa.yamloc apply -f cs-db-role.yamloc apply -f cs-db-rolebinding.yaml -
Add the deployment to the cluster.
oc apply -f cs-db-backup-deployment.yaml
Back up Zen
-
Locate
zenserviceinstances.oc get zenservice -A -
Label each zenservice.
oc label zenservice <zenservice name> foundationservices.cloudpak.ibm.com=zen --overwrite=true -n <namespace>
Back up Zen MetastoreDB
zenservice instance is installed.-
Get the Zen 5 backup resource.
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/zen5-backup-deployment.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/zen5-backup-pvc.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/zen5-br-scripts-cm.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/zen5-sa.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/zen5-role.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/zen5-rolebinding.yamlIf you use foundational services version 4.19.0 or later, use the following paths instead:
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/ibm-pg/zen5-backup-deployment.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/ibm-pg/zen5-backup-pvc.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/ibm-pg/zen5-br-scripts-cm.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/ibm-pg/zen5-sa.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/ibm-pg/zen5-role.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/ibm-pg/zen5-rolebinding.yaml -
Update the backup files.
By default, the
zen5-backup-pvc.yamlneeds to replace the following parameters:- Replace
<zenservice namespace>with the namespace where thezenserviceinstance is running. - Replace the
<storage class>with either the storage class that common service db deployment uses, or with any storage class that hasRetainReclaimPolicy.
In the
zen5-backup-deployment.yamlfile, replace all instances of<zenservice namespace>with the namespace where thezenserviceinstance is running. There are four; two are parameters for the velero backup and restore commands.By default, the backup and restore commands (represented by
.spec.template.metadata.annotations.pre.hook.backup.velero.io/command&.spec.template.metadata.annotations.post.hook.restore.velero.io/command) are scheduled to run in the<zenservice namespace>namespace as parameters to the scripts called in the commands. Edit both commands' first parameter values to match the namespace that the deployment is created in.By default, the restore command (represented by
.spec.template.metadata.annotations.post.hook.restore.velero.io/command) is set to run againstzenservicenamed<zenservice name>. Update the second parameter to match the name of thezenservicein the target namespace.In the
zen5-br-scripts-cm.yamlandzen5-sa.yaml, make sure to replace the namespace value<zenservice namespace>with the zenservice namespace in use for each instance of zenservice in use. - Replace
-
Add the PVC to the cluster.
oc apply -f zen5-backup-pvc.yaml -
Add the
zen5-br-scripts-cm.yamlto the correct namespaceoc apply -f zen5-br-scripts-cm.yaml -
Give the Zen 5 backup necessary permissions
-
For each namespace with a
zenserviceto backup, create a service account. Replace the<zenservice namespace>value before applying.oc apply -f zen5-sa.yaml -
Once per
zenservicenamespace, apply the Role for the zen backup. Replace the<zenservice namespace>value before applying.oc apply -f zen5-role.yaml -
Create the RoleBinding to connect the ServiceAccount to the Role.
- Edit the
zen5-rolebinding.yamlfile to add the ServiceAccount created earlier and replace the<zenservice namespace>value.vi zen5-rolebinding.yaml - Apply the
zen5-rolebinding.yamlfileoc apply -f zen5-rolebinding.yaml
- Edit the
-
-
Add the deployment to the cluster.
oc apply -f zen5-backup-deployment.yaml
Create a backup resource
Create a backup resource for the velero namespace.
-
Get the
schedule-common-services.yamlfile.wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/schedule-common-services.yaml -
Update the
schedule-common-services.yamlfile based on your backup requirements. For more information, see Velero Schedule API Type. By default, the backup runs once a day and is deleted 48 hours later.
The following configurations in the
schedule-common-services.yamlfile are important:-
schedule:, which is a CRON expression. CRON uses the server time, which is usually the Coordinated Universal Time unless configured to be something else. -
ttl, which is the time to live for the backup. -
storageLocation, which is the same storage location that you used when you set up OADP. The commandoc get backupstoragelocations.velero.io -n <velero namespace>can be used to get the name. -
velero, which is the namespace where you installed OADP.
-
-
Create the resource.
oc apply -f schedule-common-services.yaml -
Verify whether the backup schedule was created.
velero schedule getAfter the first scheduled time passes, you can verify whether the backup ran. Look for a schedule name and timestamp.
velero backup get -
Verify whether the backup was successful and check the details to see if all resources are saved.
velero backup describe <__BACKUP_NAME__> --details
Reconfiguring an external PostgreSQL database
Complete this step only if you use an externally provided PostgreSQL database. Otherwise, skip this step and proceed with Restoring foundational services.
If you use an externally provided PostgreSQL database, you must reconfigure your external PostgreSQL database solution and restore its data. For more information, see Configuring an external PostgreSQL database for IM. Make sure that IS_EMBEDDED field is properly set to "false" in the common-service-db-im configmap.
Restoring foundational services
Complete the following steps to restore foundational services.
Before you restore foundational services, set up Velero on the new cluster. Follow the instructions in the Create the backup resources section.
For troubleshooting issues that may arise during restore, see IBM Cloud Pak foundational services Installation Troubleshooting.
Download the necessary files for restoring different resources:
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-namespace.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-entitlementkey.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-pull-secret.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-catalog.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-operatorgroup.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-configmap.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-crd.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-commonservice.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-subscriptions.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-licensing.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-cert-manager.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-operands.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-cs-db.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-zen.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-zen5-data.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-singleton-subscriptions.yaml
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-nss.yaml
-
Restore the foundational services namespaces by using the
restore-namespace.yamlfile.-
Get the name of the Velero backup that you plan to use for restoring.
velero backup getReplace
__BACKUP_NAME__in the following commands with the Velero backup name.Verify whether the backup was successful and check the details to see if all resources are saved.
velero backup describe <__BACKUP_NAME__> --details -
Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-namespace.yaml -
Restore the namespaces.
oc apply -f restore-namespace.yamlYou can check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Verify whether the namespaces are restored. Your namespaces must be listed in the command output.
oc get namespaceProceed with the next step after the namespaces are restored.
-
Change the default project to the restored common service namespace.
oc project <namespace-where-foundational services-are-installed>
-
-
Restore the entitlement key.
- Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-entitlementkey.yaml - Restore the entitlement key.
oc apply -f restore-entitlementkey.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Verify whether the entitlement key is restored.
oc get secret
- Substitute the
-
Restore the pull secret.
-
Save the current pull secret.
oc get secret pull-secret -n openshift-config -o yaml > original-pull-secret.yaml -
Delete the current pull secret from the
openshift-confignamespace.oc delete secret pull-secret -n openshift-config - Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-pull-secret.yaml -
Restore the pull secret.
oc apply -f restore-pull-secret.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Verify whether the pull secret is restored.
oc get secret -n openshift-config | grep pull
-
-
Restore the catalog.
- Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-catalog.yaml - Restore the catalog.
oc apply -f restore-catalog.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Verify whether the catalog source is restored.
oc get catalogsource -n openshift-marketplace | grep ibm -
Verify whether the
ibm-operator-catalogpod is running.oc get pod -n openshift-marketplace -wNote: If using IBM Cert Manager, IBM Licensing, orcloud-native-postgresql-catalogcatalog source, verify that their pods areRunningas well.
If the pods are running, proceed with the next step.
- Substitute the
-
Restore the operator groups.
- Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-operatorgroup.yaml - Restore the operator groups.
oc apply -f restore-operatorgroup.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Verify whether the operator groups are restored.
oc get operatorgroup -A
- Substitute the
-
Restore the
common-service-mapsconfigmap.- Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-configmap.yaml - Restore the configmap.
oc apply -f restore-configmap.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Verify whether the configmap is restored.
oc get configmap common-service-maps -n kube-public
- Substitute the
-
Restore the commonservices.operator.ibm.com customresourcedefinition (CRD).
- Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-crd.yaml - Restore the CRD.
oc apply -f restore-crd.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Verify whether the CRD is restored.
oc get customresourcedefinition | grep commonservices.operator.ibm.com
- Substitute the
-
Restore the
CommonServiceCRs.-
Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-commonservice.yaml -
Restore the CRs.
oc apply -f restore-commonservice.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Verify whether the
CommonServiceCRs are restored.oc get commonservice -AIf a
CommonServiceCR is not restored, delete the restore resource and apply it again:- Delete the resource.
oc delete -f restore-commonservice.yaml - Restore the CR.
Wait for 30 seconds and check again for theoc apply -f restore-commonservice.yamlCommonServiceresource.
- Delete the resource.
-
-
Restore the singleton subscriptions.
-
Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-singleton-subscriptions.yaml -
Restore the subscriptions.
oc apply -f restore-singleton-subscriptions.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Watch the namespaces where Cert Manager and License Service are deployed for the Cert Manager and Licensing operators to be running. By default Cert Manager and License Service are deployed in
ibm-cert-managerandibm-licensingnamespaces.oc get pod -n <cs namespace> -w
-
-
Restore cert manager resources.
-
Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-cert-manager.yaml -
Restore the cert manager resource.
oc apply -f restore-cert-manager.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Verify whether the certificates are restored.
oc get certificates
-
-
Restore the subscriptions.
- Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-subscriptions.yaml - Restore the subscriptions.
oc apply -f restore-subscriptions.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Watch the foundational services namespace for the
operand-deployment-lifecycle-managerto be running:oc get pod -n <cs namespace> -w
See the following notes:
- If not using IBM Cert Manager, IBM Common Service Operator deployment fails unless a third-party Cert Manager is installed on the cluster beforehand.
- If using SOD, it is likely the
ibm-common-service-operatorwill not come ready after restoring the subscriptions and subsequently will not deploy ODLM. This is expected and will resolve after running the next step.
Troubleshooting: In case of issues with generating new installation plans for updates or new installations, see OLM is unable to generate new install plans.
- Substitute the
-
Restore the namespace scope resources if you use Separation of Duties (SOD).
-
Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-nss.yaml -
Restore the namespace scope resources.
oc apply -f restore-nss.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Watch the foundational services namespace for the
operand-deployment-lifecycle-managerandcommon-serviceoperator to be running:oc get pod -n <cs namespace> -w
Troubleshooting: In case of issues with generating new installation plans for updates or new installations, see OLM is unable to generate new install plans.
-
-
Restore Licensing service configmap.
-
Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-licensing.yaml -
Restore the configmap.
oc apply -f restore-licensing.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Verify whether the configmap is restored.
oc get configmap | grep licensing
-
-
If you use IBM License Service Reporter, see Backing up the License Service Reporter instance.
-
Restore the OperandRequests.
-
Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-operands.yaml -
Restore the operands.
oc apply -f restore-operands.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Verify whether the operands are restored.
oc get operandrequest -
Verify whether operand requests are reconciled.
Note: Give ODLM time to reconcile one or more restored operand requests but new operators and their operands should deploy shortly after the restore completes. Check the status fields of the operand requests and the ODLM logs for any issues. -
If using a custom hostname, TLS secret, or both, wait for the
platform-identitypods to come ready:- Verify that the
cs-onprem-tenant-configconfigmap is present:oc get cm -n <namespace where hostname is changed or custom TLS secret used> | grep cs-onprem-tenant-config - Wait for the
platform-identity-management,platform-identity-provider, andplatform-auth-servicepods to come ready in the same namespace. - Make sure to update the custom hostname to reflect a change in cluster if necessary. For example, the structure of the route is
<route name>.cluster1.com. If you are no longer oncluster1but now oncluster2, the route needs to be updated from<route name>.cluster1.com to<route name>.cluster2.com. - If using a custom TLS secret, it is best to re-create this secret on the new cluster by using the same name. In this case, if the secret was carried over to the new cluster, it would need to be replaced.
- Follow the instructions here https://www.ibm.com/docs/en/cloud-paks/foundational-services/4.3?topic=cc-updating-custom-hostname-tls-secret-by-using-configmap.
- Verify that the
-
-
Restore common-service-db
- Get the restore object
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-cs-db.yaml - Substitute the
__BACKUP_NAME__with the name of the backup resource that you created previously.vi restore-cs-db.yaml -
Restore the cs-db data.
oc apply -f restore-cs-db.yaml -
Check restore progress. Proceed with the next step after restore is complete.
velero restore get -
Check logs of the velero restore to verify that the data was restored
velero restore logs restore-zen5-data
Troubleshooting: If the logs or the data indicate that the restore was not successful, apply the following workaround:
-
Get the restore job:
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/common-service-db/cs-db-restore-job.yaml -
Replace
<cs-db namespace>with the namespace where common-service-db instance is running. -
Delete the existing cs-db-backup deployment and cs-db-backup pod.
oc delete deploy cs-db-backup -n <namespace> -
Run the restore job.
oc apply -f cs-db-restore-job.yaml
- Get the restore object
-
Restore Zen and Zen data.
-
Reconfigure the external PostgreSQL database instance. Complete this step only if you use an externally provided PostgreSQL database. For more information, see Configuring an external PostgreSQL database for IM.
-
Restore
zenserviceinstances-
Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-zen.yaml -
Restore the
zenserviceinstances.oc apply -f restore-zen.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Wait for the
zenserviceinstances to come ready. Once theProgressfield is 100%, the instance is ready. The following command will continuously output the percentage of all thezenserviceson the cluster.oc get zenservice -A -w -o yaml | grep Progress: -
Complete this step only if you use an externally provided PostreSQL database. Once the the progress status of
zenserviceis at 100%, suspend the backup cronjob with the following command:oc patch cj zen-metastore-backup-cron-job --namespace ${ZEN_NAMESPACE} --type=merge --patch '{"spec": {"suspend": true}}'
If the restored zenservice contains fields to configure
zenCustomRoute, do the following:- Verify the secret used (if the field exists) is present in the zenservice namespace in the target cluster.
- Update the value in the zenservice CR for the route. For example, the structure of the route is
<route name>.cluster1.com. If you are no longer oncluster1but now oncluster2, the route needs to be updated from<route name>.cluster1.com to<route name>.cluster2.com.
-
-
Restore zen data.
-
Substitute the
__BACKUP_NAME__with the name of the backup resource that you created in a previous step.vi restore-zen5-data.yaml -
Restore the Zen data.
oc apply -f restore-zen5-data.yaml -
Check the progress and the details of the restore by using the following commands. Proceed with the next step after the status shows as
Completed.velero restore getvelero restore describe <__RESTORE_NAME__> --details -
Check logs of the velero restore to verify that the data was restored
velero restore logs restore-zen5-data-
Search for
restore_zen5to find relevant logs. If it is not present, the restore did not run. If the logs or the data indicate that the restore was not successful, the following steps can be taken as a workaround:-
Get the Zen 5 restore job resource.
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/zen/zen5-restore-job.yaml -
Delete the existing
zen5-backupdeploymentoc delete deploy zen5-backup -n <namespace> -
Wait for the
zen5-backuppods to fully delete (fully gone, notTerminating) -
Give the zen5 backup necessary permissions if the necessary ServiceAccount, Role, and RoleBinding are not already present.
-
Check if permissions exist:
oc get sa -n <zenservice namespace> | grep zen5 oc get role | grep zen5 oc get rolebinding | grep zen5 -
Get the
zen5-sa.yaml,zen5-role.yaml, &zen5-rolebinding.yamlfiles.wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/zen5-sa.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/zen5-role.yaml wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/zen5-rolebinding.yaml -
For each namespace with a
zenserviceto backup, edit the service account filezen5-sa.yamlto deploy in the corresponding namespaceoc apply -f zen5-sa.yaml -
Once per
zenservicenamespace, apply thezen5-role.yamlfile to create the Role for the zen backup. Replace the<zenservice namespace>value before applying.oc apply -f zen5-role.yaml -
Create the RoleBinding to connect the ServiceAccounts to the Role.
- Edit the
zen5-rolebinding.yamlfile to add each ServiceAccount created earlier. Replace the<zenservice namespace>value before applying.vi zen5-rolebinding.yaml - Apply the
zen5-rolebinding.yamlfileoc apply -f zen5-rolebinding.yaml
- Edit the
-
-
Edit the
zen5-restore-job.yamlfile. The default namespace is set tozen. The parameters for the underlyingrestore_zen5.share defaulted to thezennamespace andtest-zenzenservicename. Update both of these parameters to reflect the proper namespace andzenservicerespectively. -
Apply the
zen5-restore-job.yamlfileoc apply -f zen5-restore-job.yaml -
Wait for the job to complete, then check the logs of the
zen5-restore-jobpod to verify restore completed. -
Repeat as needed for each namespace with a
zenserviceinstance installed.
-
-
-
Wait for the
zenserviceinstances to come ready. Once theProgressfield is 100%, the instance is ready. The following command will continuously output the percentage of all thezenserviceson the cluster.oc get zenservice -A -w -o yaml | grep Progress:
See the following troubleshooting tips:
-
Make sure that there is only one
zen5-backupor onezen5-restore-jobpod in a namespace at any given time as they compete for the same PVC. -
If the
zen5-restore-jobpod is stuck inContainerCreating:- delete the deployment
zen5-backup - make sure the
zen5-backuppod is fully deleted (notTerminating) - delete the
zen5-restore-jobjob and its pod (notTerminating) - ensure that the configmap
zen5-br-configmap, pvczen5-backup-pvc, rolezen5-backup-role, rolebindingzen5-backup-rolebinding, and service accountzen5-backup-saare present in the namespace - reapply the
zen5-restore-jobyaml
- delete the deployment
-
If the configmap
zen5-br-configmapis not present, it can be downloaded from:wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/zen5-br-scripts-cm.yaml.Make sure to edit the namespace field before applying with the following command:
oc apply -f zen5-br-scripts-cm.yaml -
Velero restore is less predictable than backup when restoring databases. There is no harm to deleting a velero restore object (that is,
restore-cs-db-dataorrestore-zen5-data), deleting the accompanying deployment and pvc, waiting for these items to be fully deleted, then re-creating the velero restore object to try again. Should this still not work, the secondary instructions that use thecs-db-restore-job.yamland zen5 restore job can be used on an individual namespace basis. There is no harm to running the restore in a namespace that has already been restored.
-
-
-
If you use a custom route for the restored
zenserviceand you are restoring to a new cluster, update the value ofzenCustomRoutein thezenserviceCR to reflect the new hostname and re-trigger theiam-configjob. Run the following commands:oc -n <zenservice namespace> patch zenservice <zenservice name> --type='merge' -p '{"spec":{"zenCustomRoute":{"route_host":"<updated route>"}}}' oc -n <zenservice namespace> patch zenservice <zenservice name> --type='merge' -p '{"spec":{"reconcile":true}}' oc get job -n <zenservice namespace> iam-config-job -o json | jq 'del(.spec.selector)' | jq 'del(.spec.template.metadata.labels)' | oc replace --force -f -
All restoration tasks are completed.
Verify whether foundational services are properly restored.
-
Verify the pods:
oc get podsAll pods must be running.
-
Verify the subscriptions:
oc get subscriptionsSubscriptions of all installed services must be listed.
-
Verify that the Identity and Access section of the
cp-consoleshows the users and teams that your organization added in the original cluster.
For backing up and restoring Identity Management (IM) components, see Identity management backup and restore.
For migrating existing OIDC and SAML configurations, see Migrating identity management.
General Troubleshooting:
If a restore process is stopped in the New phase when you view with velero restore get, restart the velero pod in the namespace where OADP is installed. After the velero pod restarts, the status of the restore process must change to InProgress.