IBM Cloud Pak foundational services backup and restore for clusters with a single instance 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 ImageContentSourcePolicy resource, 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 Opens in a new tab .

  • When you add a service credential to the bucket, include the hash-based message authentication code (HMAC). For more information, see Service credentials Opens in a new tab . 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:// or https://.
Note: If the cluster being backed up or restored to uses s390x for architecture, any velero CLI commands must be run on an alternate cluster that does not use s390x and has 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.

  1. Log in to your OpenShift cluster command-line interface (CLI) by using the oc login command.

  2. Create a namespace for Velero objects. The following example creates the velero namespace. For more information about Velero, see Velero documentation Opens in a new tab .

    oc project velero
    
  3. Install the Red Hat OADP operator in the velero namespace. For more information, see About installing OADP Opens in a new tab .

  4. Create a secret named cloud-credentials with the access key id and secret access key credentials.

    1. Open any editor and place the following credentials in a file named credentials-velero.

      vi credentials-velero
      
    2. Insert the following content in the file:

      [default]
      aws_access_key_id=<access_key_id>
      aws_secret_access_key=<secret_access_key>
      
    3. Create the secret.

      oc create secret generic cloud-credentials -n velero --from-file cloud=credentials-velero
      
  5. From your OpenShift cluster console OperatorHub page, install the OADP operator from the stable-1.3 channel, 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 Opens in a new tab .

  6. Create a DataProtectionApplication object.

    Note: The provider is aws even if you are not using AWS Object Storage.

    If you use Red Hat® OpenShift® Container Platform version 4.19 and onward, use the following DataProtectionApplication custom 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: 512Mi
    

    If you use a version of OpenShift Container Platform before version 4.19, use the following DataProtectionApplication 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:
        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.

Note: If you choose to label resources automatically by running the script, make sure that all resources are labeled. You can compare the labels that are added by the script with the manual steps to make sure that all necessary labels are in place.

Add labels to Usage Metering Service resources

  1. Because multiple instances of foundational services can exist on the same cluster, identify all the resources in a tenant and across the cluster. Search for namespaces in ibmservicemeterdefinitions.operator.ibm.com custom resources (CRs), ibmusagemeterings.operator.ibm.com CRs, usage metering subscriptions and operand requests, and the ibm-usage-metering-events configmap.

  2. After you determine the namespaces, run the following commands to label Usage Metering Service resources:

    oc label customresourcedefinition ibmservicemeterdefinitions.operator.ibm.com ibmusagemeterings.operator.ibm.com foundationservices.cloudpak.ibm.com=ums --overwrite=true
    oc label configmap ibm-usage-metering-events -n $namespace foundationservices.cloudpak.ibm.com=ums
    oc label ibmservicemeterdefinitions.operator.ibm.com $servicemeterCR -n $namespace foundationservices.cloudpak.ibm.com=ums --overwrite=true
    oc label ibmusagemeterings.operator.ibm.com $ums_cr -n $namespace foundationservices.cloudpak.ibm.com=ums --overwrite=true
    oc label subscriptions.operators.coreos.com $sub -n $namespace foundationservices.cloudpak.ibm.com=ums --overwrite=true
    
    • The $namespace value represents the namespace in which a resource is found.
    • The $ums_cr value represents the name of the ibmusagemeterings.operator.ibm.com CR.
    • The $servicemeterCR represents the name of the ibmservicemeterdefinitions.operator.ibm.com CR. Multiple ibmservicemeterdefinitions.operator.ibm.com CRs can exist in a namespace, so make sure to include them all.
    • The label-common-service.sh script labels these resources without any extra input.

Labelling the resources automatically by running the script

  1. Run the following commands to fetch and download the env.properties file and the label-common-services.sh script 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
    
  2. Open the env.properties file, edit the required variables and save the changes.

    Note: The OPERATOR_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.properties
    

    The env.properties file 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="" 
    
  3. Use the following command to run the label-common-service.sh script.

    ./label-common-service.sh
    
  4. Add labels to the Licensing service configmaps:

    1. Find the licensing namespace:

      oc get pods -A | grep licensing
      
    2. Get the label-licensing-configmaps.sh file.

      wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/backup/licensing/label-licensing-configmaps.sh
      
    3. Add executable permission.

      chmod +x label-licensing-configmaps.sh
      
    4. Run the script.

      ./label-licensing-configmaps.sh <namespace from previous step>
      
  5. Add labels to the Cert Manager resources:

    1. Get the label-cert-manager.sh file.
      wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/backup/cert-manager/label-cert-manager.sh
      
    2. Add executable permission.
      chmod +x label-cert-manager.sh
      
    3. Run the script.
      ./label-cert-manager.sh
      
    Note: The label-cert-manager.sh script searches all namespaces for cert manager resources. The search might require elevated privileges to run.

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 need to label the currently installed resources 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=true
    

    If you installed the ibm-user-mgmt-operator operator, 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=true
    

    A 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 with IBM under the PUBLISHER column.

    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.
  • 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-config configmap 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-config configmap 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 is ibm-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.

    1. 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-maps configmap exists:
        oc get cm common-service-maps -n kube-public
        
        If the common-service-maps configmap exists, make sure to label each namespace listed in requested-from-namespace and controlNamespace values:
        oc get cm common-service-maps -n kube-public -o yaml
        
        If the common-service-maps configmap is not present, label each namespace that is using the common service instance for smoother restoration process.
    2. 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:

    1. Get the names of the operator groups:
      oc get operatorgroup -A
      
    2. Add a label to each operator group labeled common-service, ibm-cert-manager-operator, or ibm-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.

  • Add a label to the IBM Common Service Operator subscription, there is one in each namespace where the ibm-common-service-operator pod is deployed:

    1. Determine the subscription name:

      oc get subscription -n <namespace> | grep ibm-common-service-operator
      
    2. 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 the label to the IBM Cert Manager Operator subscription:

    1. 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-operator` in it.

      oc get pods -A | grep cert-manager
      
      Note: If the cert manager operator pod is named something other than ibm-cert-manager-operator-<alphanumeric characters>, it means that a third-party certificate manager service is installed. Install this third-party cert manager on the target restore cluster before you restore subscriptions.
    2. 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:

    1. Refer to the label licensing in the preceding step to find the namespace or use the following:
      oc get pods -A | grep ibm-licensing
      
    2. Determine the subscription name:
      oc get subscriptions.operators.coreos.com -n <namespace> | grep ibm-licensing-operator
      
    3. Label the subscription:
      oc label subscriptions.operators.coreos.com <IBM licensing subscription name> foundationservices.cloudpak.ibm.com=singleton-subscription --overwrite=true -n <namespace>
      
  • Add a label to the common-service CR:

    oc label commonservices common-service foundationservices.cloudpak.ibm.com=commonservice --overwrite=true
    
    Note: If your cluster has more than one (that is, in SOD scenarios), labeling each of them will not negatively impact the restore process.
  • Add a label to the commonservices.operator.ibm.com customresourcedefinition (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:

    1. Find all entitlement keys on the cluster:

      oc get secret -A | grep ibm-entitlement-key
      
    2. Label each entitlement key:

      oc label secret ibm-entitlement-key foundationservices.cloudpak.ibm.com=entitlementkey --overwrite=true -n <namespace>
      
  • 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-operator operator, add a label to the user-mgmt-bootstrap secret:

    label secret user-mgmt-bootstrap foundationservices.cloudpak.ibm.com=cert-manager -n <namespace>
    
  • Add a label to the OperandRequests:

    1. Find operand requests to label:
      oc get operandrequests -A
      
    2. Label each OperandRequest:
      oc label operandrequests <operand request name> foundationservices.cloudpak.ibm.com=operand --overwrite=true -n <namespace>
      
    Note: Typically, foundational services OperandRequests are named common-service so any OperandRequest with this name should be labeled. However, there might be more OperandRequests to label other than the ones that are named common-service as Cloud Paks might name their operand requests something different. There are some that do not need to be labeled because they are created automatically when certain services are requested such as ibm-iam-request. There is no harm in labeling this request.
  • Label the namespacescope CRD and CR:

    Note: The following steps provide instructions for labelling the namespacescope resources, such as the namespacescope CR, 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 namespacescope subscription:

    oc label subscriptions.operators.coreos.com ibm-namespace-scope-operator -n <operator namespace> foundationservices.cloudpak.ibm.com=nss --overwrite=true
    
  • Label the namespacescope ConfigMap:

    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 namespacescope roles across namespaces:

    1. Run the following command to find all roles:

      oc get role -A | grep nss-managed-role-from
      
    2. 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 namespacescope role bindings across namespaces:

    1. Run the following command to find all role bindings:

      oc get rolebinding -A | grep nss-managed-role-from
      
    2. 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=nss label to the following resources:

    • subscriptions.operators.coreos.com ibm-namespace-scope-operator in the operator namespace:

      oc label subscriptions.operators.coreos.com ibm-namespace-scope-operator foundationservices.cloudpak.ibm.com=nss -n <operator namespace>
      
    • namespacescopes.operator.ibm.com common-service in 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-operator in 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-scope in 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

  1. 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.yaml
    
    version 4190 If 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
  2. 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.
  3. Add the PVC to the cluster.

    oc apply -f cs-db-backup-pvc.yaml
    
  4. Add the cs-db-br-script-cm-4.6.10.4.11.yaml to the correct namespace:

    oc apply -f cs-db-br-script-cm-4.6.10.4.11.yaml
    
    version 4190 If you use foundational services version 4.19.0 or later, add the cs-db-br-script-cm.yaml to the correct namespace:
    oc apply -f cs-db-br-script-cm.yaml
  5. Give the common-service-db backup necessary permissions

    oc apply -f cs-db-sa.yaml
    
    oc apply -f cs-db-role.yaml
    
    oc apply -f cs-db-rolebinding.yaml
    
  6. Add the deployment to the cluster.

    oc apply -f cs-db-backup-deployment.yaml
    

Back up Zen

  1. Locate zenservice instances.

    oc get zenservice -A
    
  2. Label each zenservice.

    oc label zenservice <zenservice name> foundationservices.cloudpak.ibm.com=zen --overwrite=true -n <namespace>
    

Back up Zen MetastoreDB

Note: Repeat this step for each namespace where a zenservice instance is installed.
  1. Get the Zen 5 backup resources.

    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.yaml
    
    version 4190 If 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
  2. Update the backup files.

    By default, the zen5-backup-pvc.yaml needs to replace the following parameters:

    • Replace <zenservice namespace> with the namespace where the zenservice instance is running.
    • Replace the <storage class> with either the storage class that common-service-db deployment uses, or with any storage class that has Retain ReclaimPolicy.

    In the zen5-backup-deployment.yaml file, replace all instances of <zenservice namespace> with the namespace where the zenservice instance 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 against zenservice named <zenservice name>. Update the second parameter to match the name of the zenservice in the target namespace.

    In the zen5-br-scripts-cm.yaml and zen5-sa.yaml, make sure to replace the namespace value <zenservice namespace> with the zenservice namespace in use for each instance of zenservice in use.

  3. Add the PVC to the cluster.

    oc apply -f zen5-backup-pvc.yaml
    
  4. Add the zen5-br-scripts-cm.yaml to the correct namespace

    oc apply -f zen5-br-scripts-cm.yaml
    
  5. Give the Zen 5 backup necessary permissions

    • For each namespace with a zenservice to backup, create a service account. Replace the <zenservice namespace> value before applying.

      oc apply -f zen5-sa.yaml
      
    • Once per zenservice namespace, 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.

      1. Edit the zen5-rolebinding.yaml file to add the ServiceAccount created earlier and replace the <zenservice namespace> value.
        vi zen5-rolebinding.yaml
        
      2. Apply the zen5-rolebinding.yaml file
        oc apply -f zen5-rolebinding.yaml
        
  6. 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.

  1. Get the schedule-common-services.yaml file.

    wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/schedule/schedule-common-services.yaml
    
  2. Update the schedule-common-services.yaml file based on your backup requirements. For more information, see Velero Schedule API Type Opens in a new tab . By default, the backup runs once a day and is deleted 48 hours later.

    The following configurations in the schedule-common-services.yaml file 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 command oc get backupstoragelocations.velero.io -n <velero namespace> can be used to get the name.
    • velero, which is the namespace where you installed OADP.
  3. Create the resource.

    oc apply -f schedule-common-services.yaml
    
  4. Verify whether the backup schedule was created.

    velero schedule get
    

    After the first scheduled time passes, you can verify whether the backup ran. Look for a schedule name and timestamp.

    velero backup get
    
  5. 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
wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-ums.yaml
  1. Restore the foundational services namespaces by using the restore-namespace.yaml file.

    1. Get the name of the Velero backup that you plan to use for restoring.

      velero backup get
      

      Replace __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
      
    2. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

      vi restore-namespace.yaml
      
    3. Restore the namespace.

      oc apply -f restore-namespace.yaml
      

      You 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. Verify whether the namespace is restored. Your namespace must be listed in the command output.

      oc get namespace
      

      Proceed with the next step after the namespace is restored.

    5. Change the default project to the restored common service namespace.

      oc project <namespace-where-foundational services-are-installed>
      
  2. Restore the entitlement key.

    1. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.
      vi restore-entitlementkey.yaml
      
    2. Restore the entitlement key.
      oc apply -f restore-entitlementkey.yaml
      
    3. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. Verify whether the entitlement key is restored.

      oc get secret
      
  3. Restore the pull secret.

    1. Save the current pull secret.

      oc get secret pull-secret -n openshift-config -o yaml > original-pull-secret.yaml
      
    2. Delete the current pull secret from the openshift-config namespace.

      oc delete secret pull-secret -n openshift-config
      
    3. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

      vi restore-pull-secret.yaml
      
    4. Restore the pull secret.

      oc apply -f restore-pull-secret.yaml
      
    5. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    6. Verify whether the pull secret is restored.

      oc get secret -n openshift-config | grep pull
      
  4. Restore the catalog.

    1. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

      vi restore-catalog.yaml
      
    2. Restore the catalog.

      oc apply -f restore-catalog.yaml
      
    3. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. Verify whether the catalog source is restored.

      oc get catalogsource -n openshift-marketplace | grep ibm
      
    5. Verify whether the ibm-operator-catalog pod is running.

      oc get pod -n openshift-marketplace -w
      
      Note: If using IBM Cert Manager, IBM Licensing, or cloud-native-postgresql-catalog catalog source, verify that their pods are Running as well.

    If the pods are running, proceed with the next step.

  5. Restore the operator group.

    1. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

      vi restore-operatorgroup.yaml
      
    2. Restore the operator group.

      oc apply -f restore-operatorgroup.yaml
      
    3. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. Verify whether the operator group is restored.

      oc get operatorgroup
      
  6. Restore common-service-maps configmap.

    1. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

      vi restore-configmap.yaml
      
    2. Restore the configmap.

      oc apply -f restore-configmap.yaml
      
    3. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. Verify whether the configmap is restored.

      oc get configmap common-service-maps -n kube-public
      
  7. Restore the commonservices.operator.ibm.com customresourcedefinition (CRD).

    1. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

      vi restore-crd.yaml
      
    2. Restore the CRD.

      oc apply -f restore-crd.yaml
      
    3. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. Verify whether the crd is restored.

      oc get customresourcedefinition | grep commonservices.operator.ibm.com
      
  8. Restore the common-service CR.

    1. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

      vi restore-commonservice.yaml
      
    2. Restore the CR.

      oc apply -f restore-commonservice.yaml
      
    3. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. Verify whether the commonservice is restored.

      oc get commonservice
      

      If the foundational services are not restored, delete the restore resource and apply it again:

      1. Delete the resource.

        oc delete -f restore-commonservice.yaml
        
      2. Restore the CR.

        oc apply -f restore-commonservice.yaml
        

        Wait for 30 seconds and check again for the CommonService resource.

  9. Restore the singleton subscriptions.

    1. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

      vi restore-singleton-subscriptions.yaml
      
    2. Restore the subscriptions.

      oc apply -f restore-singleton-subscriptions.yaml
      
    3. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. 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-manager and ibm-licensing namespaces.

      oc get pod -n <cs namespace> -w
      
  10. Restore cert manager resource.

    1. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

      vi restore-cert-manager.yaml
      
    2. Restore the cert manager resource.

      oc apply -f restore-cert-manager.yaml
      
    3. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. Verify whether the certificates are restored.

      oc get certificates
      
  11. Restore the subscriptions.

    1. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

      vi restore-subscriptions.yaml
      
    2. Restore the subscriptions.

      oc apply -f restore-subscriptions.yaml
      
    3. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. Watch the foundational services namespace for the operand-deployment-lifecycle-manager to 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-operator 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.

  12. Restore the namespace scope resources if you use Separation of Duties (SOD).

    1. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

      vi restore-nss.yaml
      
    2. Restore the namespace scope resources.

      oc apply -f restore-nss.yaml
      
    3. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. Watch the foundational services namespace for the operand-deployment-lifecycle-manager and common-service operator 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.

  13. Restore Licensing service configmap.

    1. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

      vi restore-licensing.yaml
      
    2. Restore the configmap.

      oc apply -f restore-licensing.yaml
      
    3. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. Verify whether the configmap is restored.

      oc get configmap | grep licensing
      
  14. If you use IBM License Service Reporter, see Backing up the License Service Reporter instance.

  15. Restore Usage Metering Service if you use it.

    1. Substitute the __BACKUP_NAME__ value with the name of the backup resource that you created in a previous step.

      vi restore-ums.yaml
      
    2. Restore the operands.

      oc apply -f restore-ums.yaml
      
    3. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. Verify that the ibmusagemeterings.operator.ibm.com CR, ibmservicemeterdefinitions.operator.ibm.com CRs, and the ibm-usage-metering-events configmap are restored.

    5. Wait for the ibm-usage-metering-operator operator to install and verify that the instance pod comes up.

  16. Restore the OperandRequests.

    1. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

      vi restore-operands.yaml
      
    2. Restore the operands.

      oc apply -f restore-operands.yaml
      
    3. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. Verify whether the operands are restored.

      oc get operandrequest
      
    5. Verify whether operand requests are reconciled.

      Give ODLM time to reconcile one or more restored operand requests but new operators and their operands should be seen deploying shortly after the restore completes. Check the operand requests' status fields and the ODLM logs for any issues.

    6. If using a custom hostname, TLS secret, or both, wait for the platform-identity pods to come ready:

      • Verify that the cs-onprem-tenant-config configmap 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, and platform-auth-service pods 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 on cluster1 but now on cluster2, 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.

  17. Restore common-service-db.

    1. Get the restore object.

      wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/restore-cs-db.yaml
      
    2. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created previously.

      vi restore-cs-db.yaml
      
    3. Restore the cs-db data.

      oc apply -f restore-cs-db.yaml
      
    4. Check restore progress. Proceed with the next step after restore is complete.

      velero restore get
      
    5. Check logs of the velero restore to verify that the data was restored.

      velero restore logs restore-cs-db-data
      

      Troubleshooting: If the logs or the data indicate that the restore was not successful, apply the following workaround:

      1. 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
        
      2. Replace <cs-db namespace> with the namespace where common-service-db instance is running.

      3. Delete the existing cs-db-backup deployment and cs-db-backup pod.

        oc delete deploy cs-db-backup -n <namespace>
        
      4. Run the restore job.

        oc apply -f cs-db-restore-job.yaml
        
      Note: The secondary steps that are listed here must be run only if the restore logs indicate that the restore was not run. If the storage class used on the backup cluster does not match the storage class that is used on the target cluster, the restore fails. Adapting to different storage classes across clusters is a current limitation of velero.
  18. Restore Zen and Zen data. 1. Complete this step only if you use an externally provided PostgreSQL database. Reconfigure the external PostgreSQL database instance. For more information, see Configuring an external PostgreSQL database for IM. 2. Restore zenservice instances.

    1. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

      vi restore-zen.yaml
      
    2. Restore the zenservice instances.

      oc apply -f restore-zen.yaml
      
    3. 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 get
      
      velero restore describe <__RESTORE_NAME__> --details
      
    4. Wait for the zenservice instances to come ready. Once the Progress field is 100%, the instance is ready. The following command will continuously output the percentage of all the zenservices on the cluster.

      oc get zenservice -A -w -o yaml | grep Progress:
      
    5. Complete this step only if you use an extrnally provided PostreSQL database. Once the the progress status of zenservice is 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 on cluster1 but now on cluster2, the route needs to be updated from <route name>.cluster1.com to <route name>.cluster2.com.
    1. Restore zen data.

      1. Substitute the __BACKUP_NAME__ with the name of the backup resource that you created in a previous step.

        vi restore-zen5-data.yaml
        
      2. Restore the Zen data.

        oc apply -f restore-zen5-data.yaml
        
      3. 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 get
        
        velero restore describe <__RESTORE_NAME__> --details
        
      4. Check logs of the velero restore to verify that the data was restored.

        velero restore logs restore-zen5-data
        
      5. Wait for the zenservice instances to come ready. Once the Progress field is 100%, the instance is ready. The following command will continuously output the percentage of all the zenservices on the cluster.

        oc get zenservice -A -w -o yaml | grep Progress:
        

      See the following troubleshooting tips:

      • Make sure that there is only one zen5-backup or one zen5-restore-job pod in a namespace at any given time as they compete for the same PVC.

      • If the zen5-restore-job pod is stuck in ContainerCreating:

        1. Delete the deployment zen5-backup.
        2. Make sure the zen5-backup pod is fully deleted (not Terminating).
        3. Delete the zen5-restore-job job and its pod (not Terminating).
        4. Ensure that the configmap zen5-br-configmap, pvc zen5-backup-pvc, role zen5-backup-role, rolebinding zen5-backup-rolebinding, and service account zen5-backup-sa are present in the namespace.
        5. Reapply the zen5-restore-job yaml.
      • If the configmap zen5-br-configmap is 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 Completed velero restore object (that is, restore-cs-db-data or restore-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 by using the cs-db-restore-job.yaml and 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.

  19. If you use a custom route for the restored zenservice and you are restoring to a new cluster, update the value of zenCustomRoute in the zenservice CR to reflect the new hostname and re-trigger the iam-config job. 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 pods
    

    All pods must be running.

  • Verify the subscriptions:

    oc get subscriptions
    

    Subscriptions of all installed services must be listed.

  • Verify that the Identity and Access section of the cp-console shows 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:

Stopped restore process

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.

Failed or skipped role binding

Velero has two different resource types for roles and role bindings:

  • authorization.openshift.io/v1/Role and authorization.openshift.io/v1/Rolebinding
  • rbac.authorization.k8s.io/v1/Role and rbac.authorization.k8s.io/v1/Rolebinding

One role and role binding type might appear to be completed, and the other might appear to fail or be skipped if the resource exists in the target location. If one role and role binding type is completed, you can ignore the notification about the failed or skipped type.

The data restore step ends with the PartiallyFailed status

If IM or Zen data fails to restore, and you see the PartiallyFailed status in the Velero restore object, look in the Velero restore logs for an error message similar to this example:

E1120 19:13:01.228728 19 memcache.go:265] couldn't get current server API group list: Get "https://<IP_address>": dial tcp 172.30.0.1:443: i/o timeout\n

To complete the restore, follow these steps:

  1. Find the relevant backup pod, either cs-db-backup for IM or zen5-backup for Zen.

  2. Delete the backup pod and wait for it to restart.

    Run the following commands for a foundational services database:

    get pod oc get pods -n $servicesNS | grep cs-db-backup
    delete pod oc delete pod $podName -n $servicesNS
    

    Run the following commands for Zen:

    get pod oc get pods -n $zenserviceNS | grep zen5-backup
    delete pod oc delete pod $podName -n $zenserviceNS
    
  3. Enter the exec command in the backup pod.

    • From the UI, select the pod and go to the Terminal tab.
    • Or from the terminal, enter the oc -n <namespace> exec -it <pod name> bash command.
  4. Rerun the restore command. Look at the script output and verify that the script completes.

    • For IM, run the ./cs-db/br_cs-db.sh restore <cs-db namespace> command. For later OpenShift Container Platform versions, run the command in the oc -n <namespace> exec -it <pod name> -- bash format if needed.
    • For Zen, run the ./zen5/restore_zen5.sh <zenservice namespace> <zenservice name> command.

Or download a YAML file, clean up restored resources, and apply the job:

  1. Get the restore job resource.

    • For IM, use the following restore job resource:
    wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/common-service-db/cs-db-restore-job.yaml
    
    • For Zen 5, use the following restore job resource:
    wget https://raw.githubusercontent.com/IBM/ibm-common-service-operator/scripts-adopter/velero/restore/zen/zen5-restore-job.yaml
    
  2. Delete the existing deployment.

    • For IM, delete the cs-db-backup deployment:
    oc delete deploy cs-db-backup -n <namespace>
    
    • For Zen 5, delete the zen5-backup deployment:
    oc delete deploy zen5-backup -n <namespace>
    
  3. Wait for the backup pods to fully delete. They must be fully gone and not only Terminating.

  4. Edit the YAML file.

    • For IM, edit the cs-db-restore-job.yaml file. The only parameter for the script command is the namespace. Replace the <cs-db namespace> fields with the namespace where the IM/common-service-db instance is installed.
    • For Zen 5, edit the zen5-restore-job.yaml file. The default namespace is set to zen. The parameters for the underlying restore_zen5.sh are defaulted to the zen namespace and test-zen zenservice name. Update both of these parameters to reflect the proper namespace and zenservice.
  5. Apply the restore file.

    • For IM, apply the br_cs-db.yaml restore file:
    oc apply -f br_cs-db.yaml
    
    • For Zen 5, apply the zen5-restore-job.yaml restore file:
    oc apply -f zen5-restore-job.yaml
    
  6. Wait for the job to complete. Then, check the logs of the zen5-restore-job pod to verify that the restore completed.

  7. Repeat as needed for each namespace with a zenservice or IM/common-service-db instance installed.