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/getting-started-with-volume-snapshots-on-a-kubernetes-cluster-in-hpe-greenlake-for-private-cloud-enterprise.md
+36-31Lines changed: 36 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,14 +13,15 @@ tags:
13
13
- Stateful application
14
14
- Backup and restore
15
15
- HPE GreenLake for Private Cloud Enterprise
16
+
- hpe-greenlake-for-private-cloud-enterprise
16
17
---
17
18
### Overview
18
19
19
20
20
21
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.
22
23
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.
24
25
25
26
### Persistent volumes and volume snapshots
26
27
@@ -45,11 +46,11 @@ The CSI defines a standard interface for container orchestration systems, like K
45
46
46
47
47
48
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*.
49
50
50
51
51
52
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.
53
54
54
55
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.
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.
97
98
98
99
99
100
@@ -115,7 +116,7 @@ NAME DRIVER DELETIONPOLICY AGE
115
116
gl-sbp-frank-gl1-sstor01 csi.hpe.com Delete 56d
116
117
```
117
118
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.
119
120
120
121
### Prerequisites
121
122
@@ -138,18 +139,18 @@ Before starting, make sure you meet the following requirements:
138
139
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.
139
140
140
141
141
-
1. Install MySQL application
142
+
1. Install MySQL database
142
143
143
144
144
145
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:
146
147
147
148
148
149
149
150
```markdown
150
151
151
152
152
-
$ cat setup/mysql-pvc.yaml
153
+
$ cat mysql-app/base/mysql-pvc.yaml
153
154
apiVersion: v1
154
155
kind: PersistentVolumeClaim
155
156
metadata:
@@ -168,7 +169,7 @@ spec:
168
169
169
170
170
171
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/).
172
173
173
174
174
175
@@ -182,7 +183,7 @@ mysql-app/base
182
183
183
184
184
185
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:
186
187
187
188
188
189
@@ -201,11 +202,11 @@ resources:
201
202
202
203
203
204
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*:
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'*:
435
436
436
437
437
438
@@ -461,7 +462,7 @@ volumesnapshot.snapshot.storage.k8s.io/mysql-snapshot created
461
462
462
463
463
464
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*:
465
466
466
467
467
468
@@ -491,7 +492,7 @@ Before showing the database restore, I will first delete some table from M
491
492
492
493
493
494
494
-
```markdown
495
+
```shell
495
496
$ mysql -h 127.0.0.1 -uroot -pCfeDemo@123 -P 41797
496
497
Welcome to the MariaDB monitor. Commands end with ; or \g.
0 commit comments