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 IBM Cloud Kubernetes Service cluster. You can use Portworx Backup to back up and restore IBM Cloud Kubernetes Service 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:
- Make sure that your cluster meets the minimum Portworx requirements.
- Install or update the IBM Cloud Block Storage plug-in in your cluster.
- Provision and attach 320Gi of block storage to your cluster. See Setting IBM Cloud Block Storage or Setting up Block Storage for VPC.
- Open the Portworx Backup service from the IBM Cloud catalog.
- 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 IBM Cloud Kubernetes Service dashboard.
- Enter the name for your Portworx Backup service in the Service name field.
- Select the resource group where you want to create the Portworx Backup service.
- 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.
- 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.
- In the Kubernetes or OpenShift cluster name field, select the cluster where you want to install PX-Backup.
- Enter the name of the Kubernetes namespace where you want to install your Portworx Backup service components. Do not use the
kube-system
ordefault
namespace. If the Kubernetes namespace that you enter does not already exist in your cluster, it is automatically created during the installation. - 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.
- Click Create to begin the Portworx Backup installation. The installation might take a few minutes to complete.
- Verify that your Portworx Backup service is installed correctly.
Verifying your Portworx Backup installation
Verify that Portworx Backup is correctly installed on your cluster.
- From the IBM Cloud Resource list, find the Portworx Backup service that you created.
- Review the Status column to see if the installation succeeded or failed. The status might take a few minutes to update.
- If the status changes to Active, verify that the Portworx Backup pods, services and jobs are running in your cluster.
- From the IBM Cloud Resource list, select the cluster where you installed PX-Backup.
- Open the Kubernetes dashboard.
- Select the namespace where you installed the Portworx Backup service components.
- Find the Pods table.
- Verify that the Status of all pods is Running.
- Click on Services.
- Find the px-backup-ui service and verify that a URL is present in the External Endpoints column.
- Click on Jobs.
- Find the pxcentral-post-install-hook job and verify that it is complete.
From the CLI
- From the IBM Cloud Resource list, find the Portworx Backup service you created.
- Review the Status column to see if the installation succeeded or failed. The status might take a few minutes to update.
- If the status changes to Active, verify that the Portworx Backup pods are running in your cluster.
- Log in to your account. If applicable, target the appropriate resource group. Set the context for your cluster.
- Run the command to verify that the installation has completed.
Example outputkubectl get po -n <px_backup_namespace> -ljob-name=pxcentral-post-install-hook -o wide | awk '{print $1 $3}' | grep -iv error
NAMESTATUS pxcentral-post-install-hook-5b86qCompleted
Logging in to the Portworx Backup console
Access the Portworx Backup console through the URL supplied in the IBM Cloud Kubernetes Service dashboard for the cluster where you installed the service.
For VPC clusters
- From the IBM Cloud Resource list, select the cluster where you installed PX-Backup.
- Open the Kubernetes dashboard.
- Select the namespace where you installed the Portworx Backup service components.
- In the Services section, find the px-backup-ui service and locate the URL in the Public Endpoints column. Click this URL to open the Portworx Backup console.
- 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 passwordadmin
. 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
- From the IBM Cloud Resource list, select the cluster where you installed PX-Backup.
- Open the Kubernetes dashboard.
- Select the namespace where you installed the Portworx Backup service components.
- In the Services section, find the px-backup-ui service and note the IP address and node port under External Endpoints.
- Copy and paste the IP address and node port into your web browser to open the Portworx Backup console.
- 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 passwordadmin
. 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.
- Create your IBM Cloud Object Storage service instance.
- 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.
- Expand your credentials in the service credentials table. Note the
access_key_id
and thesecret_access_key
in thecos_hmac_keys
section. - Create a storage bucket in your IBM Cloud Object Storage instance.
- Click on your bucket and note its location.
- 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.
- In the Portworx Backup console, click Backups.
- Click Settings>Cloud Settings.
- Create a cloud account to specify your IBM Cloud Object Storage instance as the backup location where your data and apps are stored.
- For the cloud provider, choose AWS / S3 Compliant Object Store.
- Enter a name for your cloud account.
- Enter the
access_key_id
that you retrieved earlier. - Enter the
secret_access_key
that you retrieved earlier. - Click Add+ and return to the Cloud Settings page.
- In the Backup Locations section, add your IBM Cloud Object Storage bucket as the backup location for your Portworx Backup service.
- Enter a name for your backup location.
- Select the cloud account that you created earlier.
- In the Path/Bucket field, enter the name of your bucket.
- In the Region field, enter the location of your bucket that you retrieved earlier.
- In the Endpoint field, enter the endpoint for your bucket that you retrieved earlier.
- Click Add+ to create the backup location.
Adding IBM Cloud Kubernetes Service clusters to your Portworx Backup service
Add the IBM Cloud Kubernetes Service 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:
- Log in to the Portworx Backup console.
- Log in to your account. If applicable, target the appropriate resource group. Set the context for your cluster.
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 ks cluster config --cluster <cluster_name> --admin --endpoint private
Adding a cluster:
- In the Portworx Backup console, click Backups.
- Click Add Cluster.
- Enter the name of the cluster that you want to back up.
- 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 thekubeconfig
from expiring.kubectl config view --flatten --minify
- Copy the entire
kubeconfig
CLI output and paste it into theKubeconfig
field in the Portworx Backup console. - Select Others as your Kubernetes Service.
- 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.
- Click Submit. If your cluster is successfully added, you are redirected to the Backups page. Make sure that your cluster is listed.
- Back up data from your cluster.
- 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.
-
From the Add Cluster page in the Portworx Backup console, copy the command to install Stork on a Non-PX cluster.
-
Open a text editor and paste the command.
-
Copy the URL in the command and enter it in to your web browser to open the YAML file for the Stork installation.
-
Copy and paste the entire YAML file into a new file in your text editor.
-
If the cluster you want to add is a private cluster, find the image field and replace
openstorage/stork:<version_number>
withicr.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
-
Save the file and run the command to apply the file to your cluster and install Stork.
kubectl apply -f <file_name>.yaml
-
Verify that Stork is successfully installed on your cluster and that all pods are running.
kubectl get deployment -n kube-system | grep stork
Example output
stork 3/3 3 3 7d20h
Creating a backup with the kmpd
command
- Install Portworx Backup in your cluster.
- Edit the
kdmp-config
ConfigMap in thekube-system
namespace of your cluster.kubectl edit cm kdmp-config -n kube-system
- Add the following parameter to the data section.
BACKUP_TYPE: "Generic"
- 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