You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/blog/how-to-backup-and-restore-stateful-applications-on-kubernetes-using-kasten-k10-in-hpe-greenlake-for-private-cloud-enterprise.md
+27-42Lines changed: 27 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ tags:
24
24
25
25
26
26
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.
28
28
29
29
### Prerequisites
30
30
@@ -43,16 +43,15 @@ Kasten K10 is a data management platform purpose-built for K8s that was develope
43
43
44
44
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.
45
45
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.
47
47
48
48
49
49
50
50
### HPE CSI driver for K8s
51
51
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.
53
53
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'*:
56
55
57
56
```markdown
58
57
$ kubectl get all -n hpe-storage
@@ -102,11 +101,13 @@ NAME DRIVER DELETIONPOLICY AGE
102
101
gl-sbp-frank-gl1-sstor01 csi.hpe.com Delete 56d
103
102
```
104
103
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.
106
105
107
106
### Install Kasten K10
108
107
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:
110
111
111
112
```shell
112
113
$ helm repo add kasten https://charts.kasten.io/
@@ -133,9 +134,9 @@ To establish a connection to it use the following `kubectl` command:
133
134
The Kasten dashboard will be available at: `http://127.0.0.1:8080/k10/#/`
134
135
```
135
136
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.
@@ -164,20 +165,6 @@ After all the Pods are in running states, edit the service *gateway* to chang
164
165
$ kubectl edit svc gateway -n kasten-io
165
166
…
166
167
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
181
168
selector:
182
169
service: gateway
183
170
sessionAffinity: None
@@ -197,13 +184,13 @@ The Kasten K10 service dashboard can then be accessed by pointing your browse
197
184
198
185

199
186
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:
201
188
202
189

203
190
204
191
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.
205
192
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*:
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.
223
210
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:
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.
234
221
235
-
1. Install MySQL database
222
+
**1. Install MySQL database**
236
223
237
224
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:
239
226
240
227
```markdown
241
228
$ cat mysql-app/base/mysql-pvc.yaml
@@ -254,7 +241,7 @@ spec:
254
241
storage: 1Gi
255
242
```
256
243
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/).
258
245
259
246
```markdown
260
247
$ tree mysql-app/base
@@ -279,7 +266,7 @@ resources:
279
266
- mysql-pvc.yaml
280
267
```
281
268
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'*:
283
270
284
271
```shell
285
272
$ kubectl apply -k mysql-app/base
@@ -303,7 +290,7 @@ NAME DESIRED CURRENT READY AGE
303
290
replicaset.apps/mysql-6974b58d48 1 1 1 24s
304
291
```
305
292
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:
307
294
308
295
```markdown
309
296
$ kubectl get persistentvolumes
@@ -316,7 +303,7 @@ NAME STATUS VOLUME CAPACITY ACCES
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.
475
462
476
463

477
464
478
465
Using all the default options from **Snapshot *mysql***, click *Snapshot Application* button:
479
466
480
467

481
468
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*:
483
470
484
471

485
472
486
473
You can also check the **Data Usage** page to see the data used by database backups:
487
474
488
475

489
476
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_:
491
478
492
479
```shell
493
-
494
480
$ k get volumesnapshot -n mysql
495
481
NAME READYTOUSE SOURCEPVC SOURCESNAPSHOTCONTENT RESTORESIZE SNAPSHOTCLASS SNAPSHOTCONTENT CREATIONTIME AGE
@@ -508,7 +494,7 @@ Before showing the database restore, I will first delete some table from M
508
494
509
495
#### Delete table
510
496
511
-
Delete data from the table *departments*:
497
+
Delete data from the table *departments* by typing the following commands:
512
498
513
499
```shell
514
500
$ 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.
523
509
524
510
Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.
525
511
526
-
527
512
MySQL [employees]> show tables;
528
513
+----------------------+
529
514
| Tables_in_employees |
@@ -682,6 +667,6 @@ This indicates the MySQL database gets recovered from its backup and MySQL da
682
667
683
668
### Summary
684
669
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.
686
671
687
672
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