Mars Zhang, Yicen Xie
Published on:2021-09-25    The number of views:

Kubernetes Backup and Restore with Kasten K10 on KubeSphere

Kasten on KubeSphere

Purpose-built for Kubernetes, Kasten 10 provides enterprise operations teams an easy-to-use, scalable, and secure system for backup/restore, disaster recovery, and mobility of Kubernetes applications.

kasten k10 arch KubeSphere is a distributed operating system for cloud-native application management, using Kubernetes as its kernel. It provides a plug-and-play architecture, allowing third-party applications to be seamlessly integrated into its ecosystem. kubesphere arch

In this article, we will introduce the deployment of Kasten K10 on KubeSphere.

Provision a KubeSphere Cluster

This article will introduce how to deploy Kasten on KubeSphere Container Platform. You can install KubeSphere on any Kubernetes cluster or Linux system, refer to KubeSphere documentation for more details or vist the Github of KubeSphere.

After the creation of KubeSphere cluster, you can log in to the KubeSphere web console:

web console Click the button "Platform" in the upper left corner and then select "Access Control"; Create a new workspace called Kasten-Workspace.

kasten-workspace Enter "Kasten-workspace" and select "App Repositoties"; Add an application repository named Kasten.

add repository Add the official Helm Repository of Kasten to KubeSphere. Helm repository address[2]:https://charts.kasten.io/

official helm repository Once completed, the repository will find its status to be "successful".

successful status

Deploy Kasten K10 on Kubernetes to Backup and Restore Cluster

First, create a Namespace to run Kasten.

create a name space After creation, click the Namespace and select "App"-"Deploy New APP"-"From App Template"successively.

deploy new app Select "Kasten" from the drop-down menu and then select "K10".

select k10 Click "K10" and enter the detail page of Chart; Click "Configuration File" to view or download the default values.yaml; Select the version and click to deploy; Set "App Name" as "K10" and select the "App Version"; Confirm the "Deployment Location", and click "Next".

page of chart For this step, we need to input required parameters to deploy Kasten K10 on KubeSphere. We need to adjust the parameters in line with our own needs. During the installation, adjust the parameters as follows and click "Deploy".

adjust parameters

global: 
  airgapped: 
    repository: "ccr.ccs.tencentyun.com/kasten-k10"
  persistence: 
    storageClass: "csi-hostpath-sc"
auth: 
  basicAuth: 
    enabled: "true"
    htpasswd: "mars:$apr1$Cgu1sGVZ$w/8aLHZkVT73OqYZ06C0v."
metering: 
  mode: "airgap"
injectKanisterSidecar: 
  enabled: "true"
prometheus: 
  server: 
    persistentVolume: 
      enabled: "false"
ingress: 
  create: "true"
  class: "nginx"

Click "Deploy" and wait for the status to turn into "running". apps Click "Deployment" to check if Kasten has deployed workload and is in running status.

workloads

In “Application Workloads” - “Routes” page, we can find the Gateway of Ingress configured previously.

routes

Log in the Management Page of Kasten K10

Input https://192.168.99.100/k10/# to the browser for the following log-in interface; Input the company and e-mail address to sign up. login page

Set the locations for storing our backup data. In this case, S3 compatible storage is selected.

settings1

Finally, start "K10 Disaster Recovery" and we can start to set "Disaster Recovery" for our cloud native application.

settings2

Deploy Cloud Native Applications on Kubernetes

Kasten Dashboard holds 16 applications, which are shown as follows. We can create a WordPress application with a WordPress Pod and Mysql Pod, a typical application that is partly stateful and partly stateless. Here are the steps.

kasten dashboard1

Create kustomization.yaml

Create “Secret Generator". A Secrete can store sensitive data such as passwords or keys. Since v1.14, kubectl supports kustomization to manage Kubernetes objects. We can use the generator in kustomization.yaml to create a Secret.

We can add a Secret Generator to kustomization.yaml as follows. It should be noted that we need to replace YOUR_PASSWORD with our actual passwords.

cat <<EOF >./kustomization.yaml
secretGenerator:
- name: mysql-pass
  literals:
  - password=YOUR_PASSWORD
EOF

Download configuration file of MySQL deployment curl -LO https://k8s.io/examples/application/wordpress/mysql-deployment.yaml Download configuration file of Wordpress curl -LO https://k8s.io/examples/application/wordpress/wordpress-deployment.yaml Add to kustomization.yaml

cat <<EOF >>./kustomization.yaml
resources:
  - mysql-deployment.yaml
  - wordpress-deployment.yaml
EOF

Apply and verify all resources applied to deploy WordPress website within kustomization.yaml and MySQL database. We can set and apply the content as follows.

kubectl create ns wordpress
kubectl apply -k ./  -n wordpress

Once completed, we can find the number of application increase to 17. kasten dashboard2 In addition, applications of the WordPress can also be find in "Applications".

wordpress

Back Up Cloud Native Applications

Click "Create Policy" and create a data backup strategy. In such a case, Kasten can protect applications by creating local snapshot, and back up the application data to cloud, thus to realize the long-term retention of data. create policy

Click "Run Once" to start backup.

start backup

Observe Dashboard and we can find backup is completed.

Complete the Recovery of Cloud Native Applications

Find "Applications" in Dashboard and then click "Restore".

restore Set the time for recovery.

recovery

Create a Namespace for recovery, which is named as "Wordpress-restore" in this case.

As every application recovered will create a new Namespace, the number of applications increases from 17 to 18. In Dashboard we can find that applications have been fully recovered.

fully recovered

In KubeSphere Dashboard, we can find these applications recovered are running.

successful running

Summary

As a container platform, KubeSphere excels in cloud native application deployment. For application developers who are not familiar with Kubernetes and hope to make simple configurations to deploy Kasten, it is easy to follow the above steps and deploy Kasten with KubeSphere. KubeSphere helps to directly deploy the official Helm repository of Kasten K10, which performs well in data management, including backup, migration and disaster recovery.

Reference

KubeSphere Official Documentation

Helm Repository Address

Kasten Official Documentation

KubeSphere GitHub

KubeSphere Official Document

KubeSphere Documentation

close

Receive the latest news, articles and updates from KubeSphere