Kubernetes Backup and Restoration with K10

Reading Time: 6 minutes

Hello Readers, Today the majority of organisations adopted micro services architecture and the rest are planning to migrate to it one of the important reasons for this is making their application highly available to consumers. For this reason many organisations use the kubernetes platform so that they will have high availability with zero downtime as kubernetes has many important key features like Replication, Load Balancing, Auto-scaling, etc. But if you think these features are only requirements to make an application highly available?

Answer would be no, because these features make any application highly available when the application is running smoothly. What about in case of any disaster? An application becomes perfectly highly available when it has a good back-up restore plan and setup along with these features of kubernetes.

In this blog we will talk about back-up and restoration of applications running on micro service architecture and understand Kubernetes backup and restoration with K10.

 

Need of the backup in Kubernetes

  • Business continuity: A Kubernetes backup solution must ensure that downtime is rare and that applications and their data can be restored quickly after downtime or data loss.
  • Data protection: Data protection strategies need to ensure data privacy and regulatory compliance (e.g., GDPR and CCPA), which become very important as more users expose their critical data online. Without proper protection, apps and data remain susceptible to potential loss and corruption.
  • Disaster recovery: Kubernetes backup reduces the risks of unplanned disruptions to data and apps.
  • Migration: Kubernetes backup software can assist businesses with migrating their Kubernetes clusters to either a new version of Kubernetes, or from on-premises to the cloud.

Steps to ensure proper backup and data protection.

The broad main stages of Kubernetes backup include:

  • Discovery: Perform automatic discovery of apps using label selectors, or namespace.
  • Identify resources: Identify the application, volumes, configuration files, and the Kubernetes clusters to be protected.
  • Backup: Complete the backup of identified resources to the designated destination.

Till now we have understood why kubernetes backup is important and How we should ensure proper backup. To make our jobs easy many platforms are available in the market for data management and backup but Kasten K10 is one of the most popular platforms for backup and data management.

Kasten’s software, called K10, provides backup and recovery for cloud-native applications and application migration.

Why Kasten K10?

  • Built for Kubernetes: K10 built on cloud-native architecture which follows the desired-state model which provides us declarative control. 
Kubernetes Backup and Restoration with K10
  • Easy to use: Easy to use via a state-of-the-art management interface or a cloud-native API. It has the versatility to accommodate complex applications easily.
Kubernetes Backup and Restoration with K10
  • End-to-end security: It provides comprehensive end-to-end security via enterprise-grade encryption, IAM roles, RBAC, OpenID Connect
Kubernetes Backup and Restoration with K10
  • Multi-Cluster Management: Kasten K10 have multi-cluster management dashboard and handle multi-cluster on single platform. Its like one stop for all.
Kubernetes Backup and Restoration with K10
  • Rich ecosystem: With extensive support for ecosystem components supports user choice to pick tools or infrastructure for the job.

Installation of K10 in Kubernetes Cluster

Prerequisite

  • Kubernetes cluster.
  • Helm 3.0 installed on a Local machine.

We will install Kasten K10 through the helm in our already created kubernetes cluster. Before installing we will create a namespace for K10.

Kubectl create namespace k10
  • Deploy demo application in demo-app namespace
kubectl apply -f https://k8s.io/examples/application/guestbook/redis-leader-deployment.yaml -n demo-app
  • Add kasten K10 helm repo
helm repo add kasten https://charts.kasten.io/
  • Install K10
helm install kasten/k10 -n k10 --generate-name

Now port-forward k10 on localhost

kubectl port-forward service/gateway -n k10 8080:8000

We can see now K10 dashboard, we have successfully installed K10 in our kubernetes cluster.

How kubernetes backup and restoration with K10

In Dashboard, we can see a section with name of Application in which 2 unmanaged applications are there which are our deployed applications in our kubernetes cluster in their respective namespaces. These are unmanaged because we didn’t have any backup policy for them.

Now we create profile for backup policy.

Here we have to give profile name and where we want to send Backup snapshots of kubernetes cluster. We will use AWS S3 storage for storage location so we have to give AWS IAM access key, secret key and S3 bucket name where want to store snapshot.

Now we will create backup policy.

After creating policy by providing frequency of snapshot like it will run everyday and run once to check if policy is running perfectly or not. We can see in below picture policy run completely and all application in kubernetes cluster now comes in complaint section which was earlier in Unmanaged section and also it created a restore point for recovery in future.
Kubernetes Backup and Restoration with K10

Now if we see in action what are things k10 have considered in backup snapshot by click in policy run. 

Kubernetes Backup and Restoration with K10

We will also check S3 bucket where it have stored all the snapshot.

Kubernetes Backup and Restoration with K10

Now we will check restoration of application in cluster back after deleting these application from cluster.

kubectl delete namespace demo-app
Kubernetes Backup and Restoration with K10
Kubernetes Backup and Restoration with K10

Run the given command in restore point.

kubectl get --raw /apis/apps.kio.kasten.io/v1alpha1/restorepointcontents/demo-app-scheduled-22mhcxjqzw
Kubernetes Backup and Restoration with K10
Kubernetes Backup and Restoration with K10

Conclusion

So in this blog we have seen Importance of data management, kubernetes backup and how we can easily make backup of kubernetes cluster with help of Kasten K10 platform.Thank you for sticking to the end. If you love this blog, please do not forget to show your appreciation by hitting like, comment and share this blog and give me suggestions on how I can improve my future posts to suit your needs.

Written by 

Abhishek Dwivedi is a DevOps Professional working in Knoldus Inc as Senior Software Consultant. Abhishek loves to juggle devops tools and learn everyday new things in new techonologies. He believes in by sharing knowledge we can gain more knowledge.