Skip to content

Commit 2cc846d

Browse files
committed
Update Blog “getting-started-with-volume-snapshots-on-a-kubernetes-cluster-in-hpe-greenlake-for-private-cloud-enterprise”
1 parent a3b0520 commit 2cc846d

File tree

1 file changed

+36
-31
lines changed

1 file changed

+36
-31
lines changed

content/blog/getting-started-with-volume-snapshots-on-a-kubernetes-cluster-in-hpe-greenlake-for-private-cloud-enterprise.md

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ tags:
1313
- Stateful application
1414
- Backup and restore
1515
- HPE GreenLake for Private Cloud Enterprise
16+
- hpe-greenlake-for-private-cloud-enterprise
1617
---
1718
### Overview
1819

1920

2021

21-
[HPE GreenLake for Private Cloud Enterprise: Containers](https://www.hpe.com/us/en/greenlake/containers.html), one of the HPE GreenLake cloud services available on the HPE GreenLake for Private Cloud Enterprise, allows customers to create a Kubernetes (K8s) cluster, view details about existing clusters, and deploy containerized applications to the cluster. It provides an enterprise-grade container management service using open source K8s.
22+
[HPE GreenLake for Private Cloud Enterprise: Containers](https://www.hpe.com/us/en/greenlake/containers.html) ("containers service"), one of the HPE GreenLake cloud services available on the HPE GreenLake for Private Cloud Enterprise, allows customers to create a Kubernetes (K8s) cluster, view details about existing clusters, and deploy containerized applications to the cluster. It provides an enterprise-grade container management service using open source K8s.
2223

23-
In this blog post, I discuss first the persistent volumes and volume snapshots in K8s. Then I describe the Container Storage Interface (CSI) and HPE CSI driver for K8s in HPE GreenLake for Private Cloud Enterprise. With a MySQL database instance deployed as a sample stateful application using persistent volume in the cluster, I show the detailed steps to create a volume snapshot of the database as a backup using HPE CSI driver. Finally I describe how to restore MySQL database using the created volume snapshot.
24+
In this blog post, I discuss first the persistent volumes and volume snapshots in K8s. Then I describe the Container Storage Interface (CSI) and HPE CSI driver for K8s in HPE GreenLake for Private Cloud Enterprise. With a MySQL database instance deployed as a sample stateful application using persistent volume in the cluster, I show the detailed steps to create a volume snapshot of the database as a backup using HPE CSI driver for K8s. Finally I demonstrate how to restore the MySQL database using the created volume snapshot.
2425

2526
### Persistent volumes and volume snapshots
2627

@@ -45,11 +46,11 @@ The CSI defines a standard interface for container orchestration systems, like K
4546

4647

4748

48-
A CSI driver for K8s is a plugin that allows K8s to access different types of storage systems, such as Azure Disks, AWS EBS, and HPE Storage, etc. HPE CSI driver for K8s is one of those CSI driver plugins that follows the K8s CSI specification and enables K8s to use various HPE storage systems, such as Nimble Storage, 3PAR and Primera.
49+
A CSI driver for K8s is a plugin that allows K8s to access different types of storage systems, such as *Azure Disks*, *AWS EBS*, and *HPE Storage*, etc. HPE CSI driver for K8s is one of those CSI driver plugins that follows the K8s CSI specification and enables K8s to use various HPE storage systems, such as *Nimble Storage*, *3PAR* and *Primera*.
4950

5051

5152

52-
As part of K8s cluster provisioning in HPE GreenLake for Private Cloud Enterprise, HPE CSI driver for K8s has been installed on the cluster. The installation consists of two components, a _controller_ component and a _per-node_ component.
53+
As part of K8s cluster provisioning in HPE GreenLake for Private Cloud Enterprise, HPE CSI driver for K8s has been installed in the cluster. The installation consists of two components, a _controller_ component and a _per-node_ component.
5354

5455
1. The controller component is deployed as a *Deployment* on any node in the K8s cluster. It implements the CSI Controller service and a list of sidecar containers, such as _external-provisioner_, _external-attacher_, _external-snapshotter_, and _external-resizer_, etc. These controller sidecar containers typically interact with K8s objects, make calls to the driver’s CSI Controller service, manage K8s events and make the appropriate calls to the CSI driver.
5556

@@ -93,7 +94,7 @@ replicaset.apps/snapshot-controller-5fd799f6b5 2 2 2 56d
9394

9495

9596

96-
As part of HPE CSI driver configuration, a list of _StorageClasses_ is created that refers to the CSI driver name. The _PersistentVolumeClaim_ (PVCs) can then be created that uses the _StorageClass_ to dynamically provision persisten volume backed by the HPE storage systems. Apart from features such as dynamic provisioning, raw block volumes, inline ephemeral volumes, and volume encryption, HPE CSI driver implements and supports volume snapshot on K8s cluster. The common snapshot controller _snapshot-controller_ and a _VolumeSnapshotClass_, together with a list of snapshot *CustomResourceDefinitions* (CRDs), gets deployed and added to the cluster.
97+
As part of HPE CSI driver configuration, a list of _StorageClasses_ is created that refers to the CSI driver name. The _PersistentVolumeClaim_ (PVC) can then be created that uses the _StorageClass_ to dynamically provision PV backed by the HPE storage systems. Apart from features such as dynamic provisioning, raw block volumes, inline ephemeral volumes, and volume encryption, HPE CSI driver implements and supports volume snapshot on K8s cluster. As you can see in above deployment, the common snapshot controller _snapshot-controller_ and a _VolumeSnapshotClass_, together with a list of snapshot *CustomResourceDefinitions* (CRDs), get all deployed and added to the cluster.
9798

9899

99100

@@ -115,7 +116,7 @@ NAME DRIVER DELETIONPOLICY AGE
115116
gl-sbp-frank-gl1-sstor01 csi.hpe.com Delete 56d
116117
```
117118

118-
In the following sections, I will describe the steps to create volume snapshots of persistent volumes in K8s using HPE CSI driver for K8s.
119+
Now that you understand the basics, in the following sections, I will describe how to create volume snapshots of persistent volumes in K8s using HPE CSI driver for K8s.
119120

120121
### Prerequisites
121122

@@ -138,18 +139,18 @@ Before starting, make sure you meet the following requirements:
138139
Before showing the volume snapshots, a MySQL database instance from [my GitHub repo](https://github.com/GuopingJia/mysql-app) will be deployed as a sample stateful application to the cluster.
139140

140141

141-
1. Install MySQL application
142+
1. Install MySQL database
142143

143144

144145

145-
MySQL database requires a persistent volume to store data. Here is the PVC YAML manifest file:
146+
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:
146147

147148

148149

149150
```markdown
150151

151152

152-
$ cat setup/mysql-pvc.yaml
153+
$ cat mysql-app/base/mysql-pvc.yaml
153154
apiVersion: v1
154155
kind: PersistentVolumeClaim
155156
metadata:
@@ -168,7 +169,7 @@ spec:
168169

169170

170171

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

173174

174175

@@ -182,7 +183,7 @@ mysql-app/base
182183

183184

184185

185-
The file kustomization.yaml lists all YAML files in its resources section, together with the secret generator for MySQL password:
186+
The file *kustomization.yaml* lists all YAML files in its resources section, together with the secret generator for MySQL password:
186187

187188

188189

@@ -201,11 +202,11 @@ resources:
201202

202203

203204

204-
Type below command to install the MySQL application to the namespace *mysql*:
205+
Typing below command to install the MySQL database to the namespace *mysql*:
205206

206207

207208

208-
```markdown
209+
```markdown
209210
$ kubectl apply -k mysql-app/base
210211
namespace/mysql created
211212
secret/mysql-pass-m62cbhd9kf created
@@ -231,7 +232,7 @@ replicaset.apps/mysql-6974b58d48 1 1 1 24s
231232

232233

233234

234-
You can check the PVC and the PV created as part of MySQL application deployment:
235+
You can check the PVC and the PV created as part of MySQL database deployment:
235236

236237

237238

@@ -268,7 +269,7 @@ The deployed MySQL database service can be accessed by typing the following m
268269

269270

270271

271-
```markdown
272+
```shell
272273
$ mysql -h 127.0.0.1 -uroot -pCfeDemo@123 -P 41797
273274
Welcome to the MariaDB monitor. Commands end with ; or \g.
274275
Your MySQL connection id is 1
@@ -295,11 +296,11 @@ MySQL [(none)]> show databases;
295296

296297

297298

298-
The MySQL database repo has the *test* folder that contains a list of scripts for populating data records and testing the contents:
299+
The MySQL application repo has the *test* folder that contains a list of scripts for populating data records and testing the contents:
299300

300301

301302

302-
```markdown
303+
```shell
303304
$ tree mysql-app/test
304305
mysql-app/test
305306
├── employees.sql
@@ -318,11 +319,11 @@ mysql-app/test
318319

319320

320321

321-
Typing the following command to populate a sample *employees* data to the database:
322+
Typing the following command to populate a sample *employees* data to the MySQL database:
322323

323324

324325

325-
```markdown
326+
```shell
326327
$ cd mysql-app/test
327328
$ mysql -h 127.0.0.1 -uroot -pCfeDemo@123 -P 41797 < employees.sql
328329
INFO
@@ -351,7 +352,7 @@ The added sample data records *employees* can be checked and verified by running
351352

352353

353354

354-
```markdown
355+
```shell
355356
$ mysql -h 127.0.0.1 -uroot -pCfeDemo@123 -P 41797
356357
Welcome to the MariaDB monitor. Commands end with ; or \g.
357358
Your MySQL connection id is 3
@@ -371,11 +372,11 @@ MySQL [(none)]> show databases;
371372
| performance_schema |
372373
+--------------------+
373374
4 rows in set (0,237 sec)
374-
375375

376376

377377

378378

379+
379380
$ mysql -h 127.0.0.1 -uroot -pCfeDemo@123 -P 41797 -t < test_employees_sha.sql
380381
+----------------------+
381382
| INFO |
@@ -431,7 +432,7 @@ $ mysql -h 127.0.0.1 -uroot -pCfeDemo@123 -P 41797 -t < test_employees_sha.sql
431432

432433

433434

434-
Here is the *VolumeSnapshot* YAML manifest file that creates a volume snapshot from the existing PVC *'mysql-pvc'*:
435+
Here is the *VolumeSnapshot* YAML manifest file that creates a volume snapshot from the PVC *'mysql-pvc'*:
435436

436437

437438

@@ -461,7 +462,7 @@ volumesnapshot.snapshot.storage.k8s.io/mysql-snapshot created
461462

462463

463464

464-
You can check the volume snapshot is created in the namespace *mysql*. A *VolumeSnapshotContent* is also created, at cluster level, with its *READYTOUSE* showing as *true*:
465+
You can check the volume snapshot *mysql-snapshot* is created in the namespace *mysql*. A *VolumeSnapshotContent* object is also created, at cluster level, with its *READYTOUSE* showing as *true*:
465466

466467

467468

@@ -491,7 +492,7 @@ Before showing the database restore, I will first delete some table from M
491492

492493

493494

494-
```markdown
495+
```shell
495496
$ mysql -h 127.0.0.1 -uroot -pCfeDemo@123 -P 41797
496497
Welcome to the MariaDB monitor. Commands end with ; or \g.
497498
Your MySQL connection id is 5
@@ -527,11 +528,11 @@ Query OK, 9 rows affected (1,523 sec)
527528

528529

529530

530-
If re-run the script *test_employees_sha.sql*, it will show the failures of *CRC* and *count*:
531+
If re-run the testing script *test_employees_sha.sql*, it will show the failures of *CRC* and *count*:
531532

532533

533534

534-
```markdown
535+
```shell
535536
$ mysql -h 127.0.0.1 -uroot -pCfeDemo@123 -P 41797 -t <test_employees_sha.sql
536537
+----------------------+
537538
| INFO |
@@ -646,7 +647,9 @@ spec:
646647
dataSource:
647648
name: mysql-snapshot
648649
kind: VolumeSnapshot
649-
apiGroup: snapshot.storage.k8s.io
650+
apiGroup: snapshot.storage.k8s.io
651+
652+
650653

651654
$ kubectl apply -f mysql-pvc-restore.yaml
652655
persistentvolumeclaim/mysql-pvc-restore created
@@ -678,11 +681,11 @@ pvc-92940c36-eb1d-4de5-9c1e-57261ccbecad 1Gi RWO Delete
678681

679682

680683

681-
3. Edit MySQL Deployment config
684+
3. Edit MySQL deployment config
682685

683686

684687

685-
Typing the following command to edit the MySQL deployment config and change the PVC name to *mysql-pvc-restore*:
688+
Typing the following command to edit the MySQL deployment config and change the PVC name from *mysql-pvc* to *mysql-pvc-restore*:
686689

687690

688691

@@ -731,11 +734,11 @@ replicaset.apps/mysql-6974b58d48 0 0 0 36m
731734

732735

733736

734-
5. Verify database data records
737+
5. Verify MySQL database data records
735738

736739

737740

738-
You can connect to the MySQL database service and re-run the test script. You should see the test script now reports everything is *OK*:
741+
You can connect to the MySQL database service and re-run the testing script. You should see the testing script now reports everything is *OK*:
739742

740743

741744

@@ -818,6 +821,8 @@ $ mysql -h 127.0.0.1 -uroot -pCfeDemo@123 -P 43959 -t <test_employees_sha.sql
818821
+---------+--------+
819822
```
820823

824+
This indicates the database restore using the volume snapshot succeeds and MySQL database data is back !
825+
821826

822827

823828
### Summary

0 commit comments

Comments
 (0)