Skip to content

Commit

Permalink
Revert "170_statefulset lab upgrade all gp2 to gp3 (aws-samples#1151)" (
Browse files Browse the repository at this point in the history
aws-samples#1174)

This reverts commit 9b46f44.
  • Loading branch information
scouturier authored Jun 9, 2021
1 parent 841d8a2 commit 93e361c
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ spec:
name: data
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: mysql-gp3
storageClassName: mysql-gp2
resources:
requests:
storage: 10Gi
8 changes: 4 additions & 4 deletions content/beginner/170_statefulset/statefulset.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ StatefulSet consists of serviceName, replicas, template and volumeClaimTemplates
* **serviceName** is "mysql", headless service we created in previous section
* **replicas** is 3, the desired number of pod
* **template** is the configuration of pod
* **volumeClaimTemplates** is to claim volume for pod based on storageClassName, `mysql-gp3` that we created in the [Define Storageclass](/beginner/170_statefulset/storageclass/) section.
* **volumeClaimTemplates** is to claim volume for pod based on storageClassName, `mysql-gp2` that we created in the [Define Storageclass](/beginner/170_statefulset/storageclass/) section.

{{% notice info %}}
[Percona Xtrabackup](https://www.percona.com/software/mysql-database/percona-xtrabackup) is used in the template to clone source MySQL server to its followers.
Expand Down Expand Up @@ -81,12 +81,12 @@ Check the dynamically created PVC by following command.
kubectl -n mysql get pvc -l app=mysql
```

We can see `data-mysql-0`, and `data-mysql-1` have been created with the STORAGECLASS `mysql-gp3`.
We can see `data-mysql-0`, and `data-mysql-1` have been created with the STORAGECLASS `mysql-gp2`.

{{< output >}}
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
data-mysql-0 Bound pvc-2a9bb222-3fbe-11ea-94be-0aff3e98c5a0 10Gi RWO mysql-gp3 22m
data-mysql-1 Bound pvc-47076f1d-3fbe-11ea-94be-0aff3e98c5a0 10Gi RWO mysql-gp3 21m
data-mysql-0 Bound pvc-2a9bb222-3fbe-11ea-94be-0aff3e98c5a0 10Gi RWO mysql-gp2 22m
data-mysql-1 Bound pvc-47076f1d-3fbe-11ea-94be-0aff3e98c5a0 10Gi RWO mysql-gp2 21m
{{< /output >}}

And now the same information from the EC2 console.
Expand Down
18 changes: 9 additions & 9 deletions content/beginner/170_statefulset/storageclass.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ cat << EoF > ${HOME}/environment/ebs_statefulset/mysql-storageclass.yaml
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: mysql-gp3
name: mysql-gp2
provisioner: ebs.csi.aws.com # Amazon EBS CSI driver
parameters:
type: gp3
type: gp2
encrypted: 'true' # EBS volumes will always be encrypted by default
volumeBindingMode: WaitForFirstConsumer # EBS volumes are AZ specific
reclaimPolicy: Delete
Expand All @@ -32,11 +32,11 @@ EoF
You can see that:

* The provisioner is `ebs.csi.aws.com`.
* The volume type is [General Purpose SSD volumes (gp3)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html#EBSVolumeTypes_gp3).
* The volume type is [General Purpose SSD volumes (gp2)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html#EBSVolumeTypes_gp2).
* The `encrypted` parameter will ensure the EBS volumes are encrypted by default.
* The [volumeBindingMode](https://kubernetes.io/docs/concepts/storage/storage-classes/#volume-binding-mode) is `WaitForFirstConsumer` to ensure persistent volume will be provisioned after Pod is created so they reside in the same AZ

Create storageclass `mysql-gp3` by following command.
Create storageclass `mysql-gp2` by following command.

```sh
kubectl create -f ${HOME}/environment/ebs_statefulset/mysql-storageclass.yaml
Expand All @@ -45,15 +45,15 @@ kubectl create -f ${HOME}/environment/ebs_statefulset/mysql-storageclass.yaml
You can verify the StorageClass and its options with this command.

```sh
kubectl describe storageclass mysql-gp3
kubectl describe storageclass mysql-gp2
```

{{< output >}}
Name: mysql-gp3
Name: mysql-gp2
IsDefaultClass: No
Annotations: <none>
Provisioner: ebs.csi.aws.com
Parameters: encrypted=true,type=gp3
Parameters: encrypted=true,type=gp2
AllowVolumeExpansion: <unset>
MountOptions:
debug
Expand All @@ -62,15 +62,15 @@ VolumeBindingMode: Immediate
Events: <none>
{{< /output >}}

We will specify `mysql-gp3` as the storageClassName in volumeClaimTemplates at “Create StatefulSet” section later.
We will specify `mysql-gp2` as the storageClassName in volumeClaimTemplates at “Create StatefulSet” section later.

{{< output >}}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: mysql-gp3
storageClassName: mysql-gp2
resources:
requests:
storage: 10Gi
Expand Down
12 changes: 6 additions & 6 deletions content/beginner/170_statefulset/testscaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ kubectl -n mysql get pvc -l app=mysql

{{< output >}}
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
data-mysql-0 Bound pvc-fdb74a5e-ba51-4ccf-925b-e64761575059 10Gi RWO mysql-gp3 18m
data-mysql-1 Bound pvc-355b9910-c446-4f66-8da6-629989a34d9a 10Gi RWO mysql-gp3 17m
data-mysql-2 Bound pvc-12c304e4-2b3e-4621-8521-0dc17f41d107 10Gi RWO mysql-gp3 9m35s
data-mysql-0 Bound pvc-fdb74a5e-ba51-4ccf-925b-e64761575059 10Gi RWO mysql-gp2 18m
data-mysql-1 Bound pvc-355b9910-c446-4f66-8da6-629989a34d9a 10Gi RWO mysql-gp2 17m
data-mysql-2 Bound pvc-12c304e4-2b3e-4621-8521-0dc17f41d107 10Gi RWO mysql-gp2 9m35s
{{< /output >}}

## Challenge
Expand Down Expand Up @@ -140,9 +140,9 @@ kubectl get persistentvolume

{{< output >}}
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-12c304e4-2b3e-4621-8521-0dc17f41d107 10Gi RWO Retain Bound mysql/data-mysql-2 mysql-gp3 9m51s
pvc-355b9910-c446-4f66-8da6-629989a34d9a 10Gi RWO Delete Bound mysql/data-mysql-1 mysql-gp3 18m
pvc-fdb74a5e-ba51-4ccf-925b-e64761575059 10Gi RWO Delete Bound mysql/data-mysql-0 mysql-gp3 18m
pvc-12c304e4-2b3e-4621-8521-0dc17f41d107 10Gi RWO Retain Bound mysql/data-mysql-2 mysql-gp2 9m51s
pvc-355b9910-c446-4f66-8da6-629989a34d9a 10Gi RWO Delete Bound mysql/data-mysql-1 mysql-gp2 18m
pvc-fdb74a5e-ba51-4ccf-925b-e64761575059 10Gi RWO Delete Bound mysql/data-mysql-0 mysql-gp2 18m
{{< /output >}}

Now, if you delete the PersistentVolumeClaim data-mysql-2, you can still see the EBS volume in your AWS EC2 console, with its state as "available".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"EBSOptions": {
"EBSEnabled": true,
"VolumeType": "gp3",
"VolumeType": "gp2",
"VolumeSize": 100
},
"AccessPolicies": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"*\"},\"Action\":\"es:ESHttp*\",\"Resource\":\"arn:aws:es:${AWS_REGION}:${ACCOUNT_ID}:domain/${ES_DOMAIN_NAME}/*\"}]}",
Expand Down
4 changes: 2 additions & 2 deletions content/intermediate/240_monitoring/deploy-grafana.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ draft: false

We are now going to install Grafana. For this example, we are primarily using the Grafana defaults,
but we are overriding several parameters. As with Prometheus, we are setting the storage class
to gp3, admin password, configuring the datasource to point to Prometheus and creating an
to gp2, admin password, configuring the datasource to point to Prometheus and creating an
[external load](https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/)
balancer for the service.

Expand All @@ -34,7 +34,7 @@ kubectl create namespace grafana

helm install grafana grafana/grafana \
--namespace grafana \
--set persistence.storageClassName="gp3" \
--set persistence.storageClassName="gp2" \
--set persistence.enabled=true \
--set adminPassword='EKS!sAWSome' \
--values ${HOME}/environment/grafana/grafana.yaml \
Expand Down
6 changes: 3 additions & 3 deletions content/intermediate/240_monitoring/deploy-prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ draft: false
#### Deploy Prometheus

First we are going to install Prometheus. In this example, we are primarily going to use the standard configuration, but we do override the
storage class. We will use [gp3 EBS volumes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) for
storage class. We will use [gp2 EBS volumes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) for
simplicity and demonstration purpose. When deploying in production, you would use
[io1](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) volumes
with desired IOPS and increase the default storage size in the manifests to get better performance. Run the following command:
Expand All @@ -18,8 +18,8 @@ kubectl create namespace prometheus

helm install prometheus prometheus-community/prometheus \
--namespace prometheus \
--set alertmanager.persistentVolume.storageClass="gp3" \
--set server.persistentVolume.storageClass="gp3"
--set alertmanager.persistentVolume.storageClass="gp2" \
--set server.persistentVolume.storageClass="gp2"
```

Make note of the prometheus endpoint in helm response (you will need this later). It should look similar to below:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ metadata:
name: staging
provisioner: kubernetes.io/aws-ebs
parameters:
type: gp3
type: gp2
fsType: ext4

0 comments on commit 93e361c

Please sign in to comment.