IBM Cloud Docs
Backing up and restoring apps and data with Portworx Backup

Backing up and restoring apps and data with Portworx Backup

Virtual Private Cloud Classic infrastructure

Portworx Backup is a Portworx proprietary backup solution that is compatible with any Red Hat OpenShift on IBM Cloud cluster. You can use Portworx Backup to back up and restore Red Hat OpenShift on IBM Cloud resources, apps and data across multiple clusters. For more information on Portworx Backup, see Understanding Portworx Backup.

To back up the data in your persistent volumes, you must have a storage class that supports snapshots in your cluster. Clusters with Portworx Enterprise have storage classes available that support snapshots by default. However, for clusters that don't have Portworx Enterprise, you must have a storage classes with snapshot support to back up your persistent volume data. The Block Storage for Classic driver, and the File Storage for Classic driver don't have storage classes that support snapshots. If you have workloads that use these drivers, you can use Portworx Backup to back up your apps, but not the data in the persistent volumes. For more information see Backing up and restoring cluster data with Portworx Backup.

Consider using Portworx Enterprise which provides options to have 3 replicas of your data in the cluster spread across multiple zones. In case of zonal storage failures, Portworx recommends using PX enterprise to get benefit of this feature. This helps ensure availability at data level in addition to application level availability.

Portworx Backup is not supported for Satellite clusters.

Installing Portworx Backup

Before you begin:

If you are installing Portworx Backup in a newly provisioned cluster, you must log in to it at least once before beginning the installation.

  1. Open the Portworx Backup service from the IBM Cloud catalog.
  2. Select the same location where the cluster you want to install Portworx Backup on is located. You can find the location of your cluster from the Red Hat OpenShift on IBM Cloud dashboard.
  3. Enter the name for your Portworx Backup service in the Service name field.
  4. Select the resource group where you want to create the Portworx Backup service.
  5. In the Tag field, enter the name of the cluster where you want to install PX-Backup. After you complete the installation, you can't see the name of the cluster where you installed PX-Backup. To find the cluster more easily later, make sure that you enter the cluster name and any additional information as tags.
  6. Enter your IBM Cloud API key. After you enter the API key, the Kubernetes or OpenShift cluster name field appears. If you don't have an IBM Cloud API key, see Creating an API key to create one.
  7. In the Kubernetes or OpenShift cluster name field, select the cluster where you want to install PX-Backup.
  8. Enter the name of the Red Hat OpenShift project where you want to install your Portworx Backup service components. Do not use the kube-system or default namespace. If the Red Hat OpenShift project that you enter does not already exist in your cluster, it is automatically created during the installation.
  9. Select an existing storage class in your cluster to provision persistent volumes for the Portworx Backup service. The service uses this storage to store service metadata and is not used to back up your apps and data. Your apps and data are backed up to an IBM Cloud Object Storage service instance.
  10. Click Create to begin the Portworx Backup installation. The installation may take a few minutes to complete.
  11. Verify that your Portworx Backup service is installed correctly.

Verifying your Portworx Backup installation

Verify that Portworx Backup is correctly installed on your cluster.

  1. From the IBM Cloud Resource list, find the Portworx Backup service that you created.
  2. Review the Status column to see if the installation succeeded or failed. The status might take a few minutes to update.
  3. If the status changes to Active, verify that the Portworx Backup pods, services and jobs are running in your cluster.
    1. From the IBM Cloud Resource list, select the cluster where you installed PX-Backup.
    2. Open the Red Hat OpenShift web console.
    3. Click on Projects.
    4. Select the namespace where you installed the Portworx Backup service components.
    5. In the Inventory section, select the option to display your pods.
    6. In the Pods table, verify that the status of each pod is Running.
    7. Click on Networking>Routes.
    8. Find the px-backup-ui route and verify that a URL is listed in the Location column.
    9. Click Workloads>Jobs.
    10. Verify that the pxcentral-post-install-hook job is complete.

From the CLI

  1. From the IBM Cloud Resource list, find the Portworx Backup service you created.
  2. Review the Status column to see if the installation succeeded or failed. The status might take a few minutes to update.
  3. If the status changes to Active, verify that the Portworx Backup pods are running in your cluster.
    1. Access your Red Hat OpenShift cluster.
    2. Run the command to verify that the installation has completed.
      oc get po -n <px_backup_namespace> -ljob-name=pxcentral-post-install-hook  -o wide | awk '{print $1   $3}' | grep -iv error
      
      Example output
      NAMESTATUS
      pxcentral-post-install-hook-5b86qCompleted
      

Logging in to the Portworx Backup console

Access the Portworx Backup console through the URL supplied in the Red Hat OpenShift on IBM Cloud dashboard for the cluster where you installed the service.

For VPC clusters

  1. From the IBM Cloud Resource list, select the cluster where you installed PX-Backup.
  2. Open the Red Hat OpenShift web console .
  3. Click on Networking>Routes.
  4. Find the px-backup-ui route and click on the URL that is listed in the Location column to open the Portworx Backup console.
  5. Log in to the Portworx Backup console. If you are the first user to access the console, you must log in in with the username admin and the password admin. You are redirected to a registration page to set a unique username and password. Subsequent users must register a new account to access the console.

For public classic clusters

  1. From the IBM Cloud Resource list, select the cluster where you installed PX-Backup.
  2. Open the Red Hat OpenShift web console .
  3. Click on Networking>Routes.
  4. Find the px-backup-ui route and note the IP address and node port listed in the Locations column.
  5. Copy and paste the IP address and node port into your web browser to open the Portworx Backup console.
  6. Log in to the Portworx Backup console. If you are the first user to access the console, you must log in in with the username admin and the password admin. You are redirected to a registration page to set a unique username and password. Subsequent users must register a new account to access the console.

For private classic clusters, expose the px-backup-ui service on your private cluster to access the Portworx Backup console.

Adding a backup location to your Portworx Backup service

Create an IBM Cloud Object Storage instance and bucket, and add them as a backup location to your Portworx Backup service.

Before you begin, log in to the Portworx Backup console. Note that if you are the first user to access the console, you must login in with the username admin and the password admin. You are redirected to a registration page to set a unique username and password. Subsequent users must register a new account to access the console.

  1. Create your IBM Cloud Object Storage service instance.
  2. Create service credentials for your IBM Cloud Object Storage service instance. Be sure to enable HMAC authentication by clicking Advanced Options in the Create credential dialog box and switching the Include HMAC Credential parameter to On.
  3. Expand your credentials in the service credentials table. Note the access_key_id and the secret_access_key in the cos_hmac_keys section.
  4. Create a storage bucket in your IBM Cloud Object Storage instance.
  5. Click on your bucket and note its location.
  6. Open the bucket configuration page and note the endpoint that you must use to connect to your IBM Cloud Object Storage instance.
    • If you installed Portworx Backup on a private classic cluster, note the private endpoint.
    • If you installed Portworx Backup on a private VPC cluster, note the direct endpoint.
    • For all other cluster types, note the public endpoint.
  7. In the Portworx Backup console, click Backups.
  8. Click Settings>Cloud Settings.
  9. Create a cloud account to specify your IBM Cloud Object Storage instance as the backup location where your data and apps are stored.
    1. For the cloud provider, choose AWS / S3 Compliant Object Store.
    2. Enter a name for your cloud account.
    3. Enter the access_key_id that you retrieved earlier.
    4. Enter the secret_access_key that you retrieved earlier.
    5. Click Add+ and return to the Cloud Settings page.
  10. In the Backup Locations section, add your IBM Cloud Object Storage bucket as the backup location for your Portworx Backup service.
    1. Enter a name for your backup location.
    2. Select the cloud account that you created earlier.
    3. In the Path/Bucket field, enter the name of your bucket.
    4. In the Region field, enter the location of your bucket that you retrieved earlier.
    5. In the Endpoint field, enter the endpoint for your bucket that you retrieved earlier.
    6. Click Add+ to create the backup location.

Adding Red Hat OpenShift on IBM Cloud clusters to your Portworx Backup service

Add the Red Hat OpenShift on IBM Cloud cluster that you want to back up with PX-Backup. You can select any cluster in your account, including the cluster where you installed PX-Backup.

Before you begin:

The kubeconfig in clusters with Portworx Backup expires after 24 hours. To prevent your cluster's kubeconfig file from expiring, set the context with your cluster using the --admin option. ibmcloud oc cluster config --cluster <cluster_name> --admin --endpoint private

Adding a cluster:

  1. In the Portworx Backup console, click Backups.
  2. Click Add Cluster.
  3. Enter the name of the cluster that you want to back up.
  4. In the CLI, get the kubeconfig file output for your cluster. Make sure that you have set the context to your cluster with the --admin option to prevent the kubeconfig from expiring.
    oc config view --flatten --minify
    
  5. Copy the entire kubeconfig CLI output and paste it into the Kubeconfig field in the Portworx Backup console.
  6. Select Others as your Kubernetes Service.
  7. If the cluster that you want to add to the Portworx Backup service does not have Portworx installed in it, you must install Stork onto the cluster. If you installed Portworx Enterprise in your cluster, Stork is installed by default.
  8. Click Submit. If your cluster is successfully added, you are redirected to the Backups page. Make sure that your cluster is listed.
  9. Back up data from your cluster.
  10. Repeat these steps to add more clusters to your Portworx Backup service.

Installing Stork on a non-Portworx cluster

If a cluster that you want to back up with Portworx Backup does not have Portworx Enterprise installed on it, you must install Stork on to the cluster before adding it to your Portworx Backup service.

  1. From the Add Cluster page in the Portworx Backup console, copy the command to install Stork on a Non-PX cluster.

  2. Open a text editor and paste the command.

  3. Copy the URL in the command and enter it in to your web browser to open the YAML file for the Stork installation.

  4. Copy and paste the entire YAML file into a new file in your text editor.

  5. If the cluster you want to add is a private cluster, find the image field and replace openstorage/stork:<version_number> with icr.io/ext/portworx/stork:<version_numer>. To find the latest available version of Stork, see the Stork releases.

    - --health-monitor-interval=120
    - --webhook-controller=false
    image: openstore/stork:2.6.2
    imagePullPolicy:Always
    resources:
      requests:
         cpu: '0.1'
      name: stork
    serviceAccountName: stork-account  
    
  6. Save the file and run the command to apply the file to your cluster and install Stork.

    oc apply -f <file_name>.yaml
    
  7. Verify that Stork is successfully installed on your cluster and that all pods are running.

    oc get deployment -n kube-system | grep stork
    

    Example output

    stork                3/3   3      3      7d20h
    

Creating a backup with the kmpd command

  1. Install Portworx Backup in your cluster.
  2. Edit the kdmp-config ConfigMap in the kube-system namespace of your cluster.
    kubectl edit cm kdmp-config -n kube-system
    
  3. Add the following parameter to the data section.
    BACKUP_TYPE: "Generic"
    
  4. Follow the Portworx Backup documentation to create a backup.

Backing up and restoring cluster data with PX-Backup

To back up data from your cluster or to restore data to your cluster, refer to the Portworx Backup documentation.

Back up apps and data from your cluster to IBM Cloud Object Storage: You can back up an entire cluster namespace, single apps, and the data that is stored in your persistent volumes to the IBM Cloud Object Storage service instance that you set up as your backup location. Note that to back up data in persistent volumes, you must have a CSI snapshot storage class in your cluster. Portworx Backup uses this storage class to first take a snapshot of your data and then sends this data to your IBM Cloud Object Storage backup location. For more information, see the Portworx Backup documentation.

Restore any backup that you created to another cluster: You can restore an entire namespace, your apps, or your data to any cluster that you added to the Portworx Backup service. Use this Portworx Backup capability if you want to migrate apps and data from one cluster to another. For more information, see the Portworx Backup documentation.

Upgrading PX-Backup

Follow the Portworx documentation to upgrade PX-backup