Skip to content

Commit c4e1d20

Browse files
committed
Update Blog “how-to-backup-and-restore-stateful-applications-on-kubernetes-using-kasten-k10-in-hpe-greenlake-for-private-cloud-enterprise”
1 parent 28bf122 commit c4e1d20

File tree

1 file changed

+27
-42
lines changed

1 file changed

+27
-42
lines changed

content/blog/how-to-backup-and-restore-stateful-applications-on-kubernetes-using-kasten-k10-in-hpe-greenlake-for-private-cloud-enterprise.md

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ tags:
2424

2525

2626

27-
In this blog post, I will describe how to use Kasten K10 to backup and restore stateful applications on a K8s cluster deployed in HPE GreenLake for Private Cloud Enterprise. Kasten K10 leverages the volume snapshot capability in the HPE Container Storage Interface (CSI) driver for K8s, which allows it to connect to various HPE storage systems in K8s. It offers a powerful and intuitive interface and platform that enables you to easily backup and restore the persistent volumes of your stateful applications in the cluster.
27+
In this blog post, I will describe how to use Kasten K10 to backup and restore stateful applications deployed in a K8s cluster in HPE GreenLake for Private Cloud Enterprise. Kasten K10 leverages the volume snapshot capability in HPE Container Storage Interface (CSI) driver for K8s, which allows it to connect to various HPE storage systems in K8s. It offers a powerful and intuitive interface and platform that enables to easily backup and restore persistent volumes of the stateful applications in the cluster.
2828

2929
### Prerequisites
3030

@@ -43,16 +43,15 @@ Kasten K10 is a data management platform purpose-built for K8s that was develope
4343

4444
Kasten K10 has been named [a Leader and Outperformer in GigaOm’s K8s Data Protection report for the third consecutive year]( https://www.veeam.com/news/kasten.html). It offers an easy-to-use, scalable, and secure system for K8s backup/restore, disaster recovery and mobility of K8s applications.
4545

46-
Apart from direct integration with a number of storage providers, Kasten K10 supports invoking volume snapshots operations via the CSI driver. By using the volume snapshot capability in the CSI driver for K8s, Kasten K10 can access different types of storage systems that enables you to backup and restore persistent volumes of your stateful applications running on K8s.
46+
Apart from direct integration with a number of storage providers, Kasten K10 supports invoking volume snapshots operations via the CSI driver for K8s. By using the volume snapshot capability in the CSI driver for K8s, Kasten K10 can access different types of storage systems that enables you to backup and restore persistent volumes of the stateful applications running on K8s.
4747

4848

4949

5050
### HPE CSI driver for K8s
5151

52-
The Container Storage Interface (CSI) defines a standard interface for exposing storage systems to container orchestration systems, like K8s. The CSI driver for K8s is a software component that implements the CSI specification and provides a way for K8s to interact with external storage systems. There are several CSI drivers available for K8s. HPE CSI Driver for K8s is one of those CSI drivers developed by HPE that uses the CSI to perform data management operations on various HPE storage systems, such as Nimble Storage, 3PAR and Primera.
52+
The CSI defines a standard interface for exposing storage systems to container orchestration systems, like K8s. The CSI driver for K8s is a software component that implements the CSI specification and provides a way for K8s to interact with external storage systems. There are several CSI drivers available for K8s. HPE CSI Driver for K8s is one of those CSI drivers developed by HPE that uses the CSI to perform data management operations on various HPE storage systems, such as Nimble Storage, 3PAR and Primera.
5353

54-
HPE CSI driver for K8s has been installed and configured as part of K8s cluster provisioning in HPE GreenLake for Private Cloud Enterprise. The following shows the details about deployed HPE CSI driver for K8s in the cluster
55-
to the namespace *hpe-storage*:
54+
HPE CSI driver for K8s has been installed and configured as part of K8s cluster provisioning in HPE GreenLake for Private Cloud Enterprise. The following shows the details about deployed HPE CSI driver for K8s in the cluster to the namespace *'hpe-storage'*:
5655

5756
```markdown
5857
$ kubectl get all -n hpe-storage
@@ -102,11 +101,13 @@ NAME DRIVER DELETIONPOLICY AGE
102101
gl-sbp-frank-gl1-sstor01 csi.hpe.com Delete 56d
103102
```
104103

105-
HPE CSI driver for K8s and Kasten K10 has been a supported data management solution through the [joint partnership between HPE and Veeam]( https://www.kasten.io/kubernetes/resources/blog/kubernetes-backup-with-hpe-csi-and-kasten-k10). In the following sections, I will first deploy the Kasten k10 to the cluster. Then, I will describe how to use Kasten K10 with the volume snapshot capability from HPE CSI driver for K8s for backup and restore of stateful applications running in the cluster.
104+
HPE CSI driver for K8s and Kasten K10 has been a supported data management solution through the [joint partnership between HPE and Veeam]( https://www.kasten.io/kubernetes/resources/blog/kubernetes-backup-with-hpe-csi-and-kasten-k10). In the following sections, I will first deploy Kasten k10 to the cluster. Then I will describe how to use Kasten K10 with the volume snapshot capability from HPE CSI driver for K8s to backup and restore persistent volumes of the stateful applications running in the cluster.
106105

107106
### Install Kasten K10
108107

109-
Kasten K10 runs in its own namespace and is deployed on K8s like any other application. Following the [Kasten K10 installation page](https://docs.kasten.io/latest/index.html), the Kasten K10 can be installed to the cluster with the following commands using helm:
108+
Kasten K10 can be deployed on K8s like any other application, and it runs in its own namespace.
109+
110+
Following the [Kasten K10 installation page](https://docs.kasten.io/latest/index.html), Kasten K10 can be installed to the cluster with the following commands using helm:
110111

111112
```shell
112113
$ helm repo add kasten https://charts.kasten.io/
@@ -133,9 +134,9 @@ To establish a connection to it use the following `kubectl` command:
133134
The Kasten dashboard will be available at: `http://127.0.0.1:8080/k10/#/`
134135
```
135136

136-
The Kasten K10 will be installed to the namespace *kasten-io* in the cluster. To validate the installation, typing the following command to watch for the status of all Pods. Helm installs a list of Pods to the namespace. It takes a while before all those Pods start running.
137+
With above commands, Kasten K10 is installed to the namespace *'kasten-io'* in the cluster. To validate the installation, typing the following command to watch for the status of all Pods. Helm installs a list of Pods to the namespace. It takes a while before all those Pods start running.
137138

138-
```markdown
139+
```shell
139140
$ kubectl get pods -n kasten-io -w
140141
NAME READY STATUS RESTARTS AGE
141142
aggregatedapis-svc-6fc8fcf7bd-cdw8p 1/1 Running 0 15m
@@ -164,20 +165,6 @@ After all the Pods are in running states, edit the service *gateway* to chang
164165
$ kubectl edit svc gateway -n kasten-io
165166
166167
spec:
167-
clusterIP: 10.102.36.25
168-
clusterIPs:
169-
- 10.102.36.25
170-
externalTrafficPolicy: Cluster
171-
internalTrafficPolicy: Cluster
172-
ipFamilies:
173-
- IPv4
174-
ipFamilyPolicy: SingleStack
175-
ports:
176-
- name: http
177-
nodePort: 31334
178-
port: 8000
179-
protocol: TCP
180-
targetPort: 8000
181168
selector:
182169
service: gateway
183170
sessionAffinity: None
@@ -197,13 +184,13 @@ The Kasten K10 service dashboard can then be accessed by pointing your browse
197184

198185
![](/img/k10-login.png)
199186

200-
Clicking *Accept Terms* after specifying your email and company name, you will be landed to Kasten K10 Dashboard:
187+
Click *Accept Terms* after specifying your email and company name, you will be landed to Kasten K10 Dashboard:
201188

202189
![](/img/k10-dashboard.png)
203190

204191
Kasten K10 automatically discovers all the applications and their data across namespaces in the cluster. The K10 dashboard displays a list of applications that are mapped to namespaces. It also displays a summary of the cluster’s backup data footprint, showing *0.0 B* when accessing the dashboard for the first time.
205192

206-
To use Kasten K10 with HPE CSI driver for K8s, you need to ensure the configured *VolumeSnapshotClass* in the cluster contains the K10 annotation _ k10.kasten.io/is-snapshot-class: "true"_. Typing the following command to add this required K10 annotation:
193+
To use Kasten K10 with HPE CSI driver for K8s, you need to ensure the configured *VolumeSnapshotClass* in the cluster contains the K10 annotation _**k10.kasten.io/is-snapshot-class: "true"**_. Typing the following command to add this required K10 annotation to the *VolumeSnapshotClass*:
207194

208195
```shell
209196

@@ -221,7 +208,7 @@ volumesnapshotclasses.snapshot.storage.k8s.io/gl-sbp-frank-gl1-sstor01 annotated
221208

222209
Whenever Kasten K10 detects volumes that were provisioned via the CSI driver deployed in the cluster, it will look for a *VolumeSnapshotClass* with this K10 annotation for the identified CSI driver and use it to create snapshots.
223210

224-
Typing the following command to verify the *VolumeSnapshotClass* has the K10 annotation added:
211+
Typing the following command to verify the *VolumeSnapshotClass* has the required K10 annotation added:
225212

226213
```shell
227214
$ kubectl get volumesnapshotclass gl-sbp-frank-gl1-sstor01 -o yaml -o jsonpath='{.metadata.annotations}' | jq . | grep kasten
@@ -230,12 +217,12 @@ $ kubectl get volumesnapshotclass gl-sbp-frank-gl1-sstor01 -o yaml -o jsonpath='
230217

231218
### Deploy MySQL database
232219

233-
In order to show backup and restore process, an MySQL database from [my GitHub repo](https://github.com/GuopingJia/mysql-app) will be deployed as a sample stateful application to the cluster.
220+
In order to show backup and restore process, an MySQL database instance from [my GitHub repo](https://github.com/GuopingJia/mysql-app) will be deployed as a sample stateful application to the cluster.
234221

235-
1. Install MySQL database
222+
**1. Install MySQL database**
236223

237224

238-
MySQL database requires a persistent volume to store data. Here is the PVC YAML manifest file *mysql-pvc.yaml* in the repo's *base* folder:
225+
MySQL database requires a persistent volume to store data. Here is the *PersistentVolumeClaim* (PVC) YAML manifest file *mysql-pvc.yaml* in the repo's *'base'* folder:
239226

240227
```markdown
241228
$ cat mysql-app/base/mysql-pvc.yaml
@@ -254,7 +241,7 @@ spec:
254241
storage: 1Gi
255242
```
256243

257-
This PVC file, together with other YAML manifest files in the folder *base*, will be used to install the MySQL database using [Kustomize](https://kustomize.io/).
244+
This PVC file, together with other YAML manifest files in the folder *base*, will be used to install the MySQL database instance using [Kustomize](https://kustomize.io/).
258245

259246
```markdown
260247
$ tree mysql-app/base
@@ -279,7 +266,7 @@ resources:
279266
- mysql-pvc.yaml
280267
```
281268

282-
Typing below command to install the MySQL database to the namespace *mysql*:
269+
Typing below command to install the MySQL database to the namespace *'mysql'*:
283270

284271
```shell
285272
$ kubectl apply -k mysql-app/base
@@ -303,7 +290,7 @@ NAME DESIRED CURRENT READY AGE
303290
replicaset.apps/mysql-6974b58d48 1 1 1 24s
304291
```
305292

306-
You can check the PV and the PVC created as part of database deployment:
293+
You can check the *PersistentVolume* (PV) and the PVC provisioned as part of the MySQL database deployment:
307294

308295
```markdown
309296
$ kubectl get persistentvolumes
@@ -316,7 +303,7 @@ NAME STATUS VOLUME CAPACITY ACCES
316303
mysql-pvc Bound pvc-3e55e9b3-097f-4ddf-bdcb-60825a7905ec 1Gi RWO gl-sbp-frank-gl1-sstor01 9m50s
317304
```
318305

319-
2. Access MySQL database
306+
**2. Access MySQL database**
320307

321308
In order to access MySQL database service using the mysql CLI, set first the port-forward of *service/mysql*:
322309

@@ -350,10 +337,10 @@ MySQL [(none)]> show databases;
350337
3 rows in set (0,282 sec)
351338
```
352339

353-
3. Populate MySQL database
340+
**3. Populate MySQL database**
354341

355342

356-
The MySQL application repo has the *test* folder that contains a list of scripts for populating data records and testing the contents:
343+
The MySQL application repo has the *'test'* folder that contains a list of scripts for populating data records and testing the contents:
357344

358345
```markdown
359346
$ tree mysql-app/test
@@ -471,26 +458,25 @@ $ mysql -h 127.0.0.1 -uroot -pCfeDemo@123 -P 42281 -t < test_employees_sha.sql
471458

472459
### Back up MySQL database
473460

474-
In order to back up the MySQL database, go to the Kasten K10 Dashboard and click the Applications. Find the deployed MySQL database *'mysql'* from the application list and expand its menu. Then click *Snapshot* button.
461+
In order to back up the MySQL database, go to the Kasten K10 Dashboard and click the _Applications_. Find the deployed MySQL database *'mysql'* from the application list and expand its menu. Then click *Snapshot* button.
475462

476463
![](/img/k10-backup-button.png)
477464

478465
Using all the default options from **Snapshot *mysql***, click *Snapshot Application* button:
479466

480467
![](/img/k10-backup.png)
481468

482-
The snapshot of the MySQL database will be started that takes a few seconds. Go back to the K10 Dashboard, you should see the completed *Backup* entry under **Actions**:
469+
The snapshot of the MySQL database will be started that takes a few seconds. Go back to the K10 Dashboard, you should see the completed *Backup* entry under **Actions** with protected object as *mysql*:
483470

484471
![](/img/k10-dashboard-backup.png)
485472

486473
You can also check the **Data Usage** page to see the data used by database backups:
487474

488475
![](/img/k10-data-backup.png)
489476

490-
In the cluster, after snapshot of the MySQL database, you can check there is a *VolumeSnapshot* _k10-csi-snap-ltxzrwxgp6r5pwkp_ created from the PVC *mysql-pvc* in the namespace *mysql*, together with a *VolumeSnapshotContent* object created at cluster level:
477+
In the cluster, after snapshot of the MySQL database, you can check there is a *VolumeSnapshot* _k10-csi-snap-ltxzrwxgp6r5pwkp_ created from the PVC *mysql-pvc* in the namespace *mysql*, together with a *VolumeSnapshotContent* object created at cluster level. The _READYTOUSE_ of the *VolumeSnapshot* should be showing as _true_:
491478

492479
```shell
493-
494480
$ k get volumesnapshot -n mysql
495481
NAME READYTOUSE SOURCEPVC SOURCESNAPSHOTCONTENT RESTORESIZE SNAPSHOTCLASS SNAPSHOTCONTENT CREATIONTIME AGE
496482
k10-csi-snap-ltxzrwxgp6r5pwkp true mysql-pvc 1Gi gl-sbp-frank-gl1-sstor01 snapcontent-f3890356-d47f-4b36-a7e4-eb4c5792ec59 6d12h 6d12h
@@ -508,7 +494,7 @@ Before showing the database restore, I will first delete some table from M
508494

509495
#### Delete table
510496

511-
Delete data from the table *departments*:
497+
Delete data from the table *departments* by typing the following commands:
512498

513499
```shell
514500
$ mysql -h 127.0.0.1 -uroot -pCfeDemo@123 -P 42281 -Demployees
@@ -523,7 +509,6 @@ Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
523509

524510
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
525511

526-
527512
MySQL [employees]> show tables;
528513
+----------------------+
529514
| Tables_in_employees |
@@ -682,6 +667,6 @@ This indicates the MySQL database gets recovered from its backup and MySQL da
682667

683668
### Summary
684669

685-
In this blog post, I described persistent volumes, volume snapshots, and the CSI driver in K8s. Using HPE CSI driver for K8s, I demonstrated how to create a volume snapshot of a MySQL database and how to restore database using the created volume snapshot in the cluster. The volume snapshot capability can be easily integrated with third-party tools like Kasten K10 by Veeam as an automatic backup and recovery solution. It can significantly simplify the process and enhance the robustness of data management in a K8s cluster.
670+
In this blog post, I introduced and discussed Kasten K10 and HPE CSI driver for K8s. Using the volume snapshot capability in HPE CSI driver for K8s, I demonstrated how to use Kasten K10 dashboard to backup the persistent volume of a sample MySQL database deployed in the cluster, and how to restore databasae using the created backup. Kasten K10 provides a powerful and intuitive interface that enables you to easily backup and restore the stateful applications running in the cluster. It can significantly simplify the process and enhance the robustness of data management in a K8s cluster.
686671

687672
You can keep coming back to the [HPE Developer blog]( https://developer.hpe.com/blog/) to learn more about HPE GreenLake for Private Cloud Enterprise.

0 commit comments

Comments
 (0)