Backup and Restore Kubernetes Applications Using Portworx
When deploying any enterprise application it is always important to think about the BC/DR strategy. Containers work really great from a Business Continuity perspective as they are stateless, but what happens if you lose the entire datacenter? What happens if you need to migrate an application to another site? PX-Backup from Portworx by Pure Storage is a great tool for this! Lets take a look how we can backup and restore applications using PX-Backup
PX-Backup is a tool that you can use to effortlessly backup, restore and migrate applications across any environment. It can be trialed free for 30 days if you want to play with it in an environment before you buy. Here is the official documentation on how to install PX-Backup, however Jon Owings has a great post on how to get Portworx up and running on VMware TKG. This process will also be simplified in the future to be more natively integrated.
The section will cover how to Add a Kubernetes cluster and configure a Backup Location.
Add a Kubernetes Cluster
Navigate to Add a cluster, enter in a name and run
kubectl config view --flatten --minify to get your kubeconfig output for the cluster, select a Kubernetes Service and hit submit.
If you are not currently running Portworx, you will need to install Stork 2.4+ on the cluster. Also, your Kubernetes cluster must have at least 3 worker nodes.
1curl -fsL -o stork-spec.yaml "https://install.portworx.com/2.5?comp=stork&storkNonPx=true" 2kubectl apply -f stork-spec.yaml
Configure a PX-Backup Repository
To setup a backup repository navigate to the Backups tab and select Settings and then Cloud Settings
In my example I will be backing up to a Pure Storage FlashBlade over S3. So I will first need to setup a Cloud Account
Next, i will need to create a Backup Location with the details of my location such as which Cloud Account to use and then the path/backup region and endpoints.
We are now setup to start a backup and restore of our application!
Backup an Application Using PX-Backup
Once PX-Backup is deployed and you have your cluster added you can navigate to your deployed application. Select the resources you wish to backup and select Backup.
Enter in a name for your Backup, select a Backup location and if needed add a pre/post exec rule and any label.
Here you can monitor the status of your backup.
When it is complete, you can see the details such as cluster, volumes, size, namespaces and resources.
Restore an Application Using PX-Backup
Here I have simulated a “failure” by deleting my application. The next steps will include how to restore your application.
If you navigate to your Backup and select Restore you can enter in a Name for your backup, the destination cluster you can customize the type of resource, select which resources to restore and if needed replace existing resources.
Monitor the status of the restore.
Once it is complete, you can see the resources that were restored.
If we review the namespace using kubectl we can see all the resources are back and our application is running.
Hopefully this walkthrough has helped you get started with Portworx PX-Backup. It is a nice and powerfull tool to be able to backup, restore and migrate your Kubernetes applications. If you have any additional questions or comments, please leave them below!comments powered by Disqus
- Considerations for vSphere Component Backup and Restore: Part 2
- Considerations for vSphere Component Backup and Restore: Part 1
- Updating a vSphere with Kubernetes Supervisor Cluster
- Deploying Tanzu Kubernetes Clusters (TKC) on vSphere with Kubernetes using the TKG CLI
- Deploying Tanzu Kubernetes Grid (TKG) on VMware Cloud on AWS (VMC)