StatefulSet consists of serviceName, replicas, template and volumeClaimTemplates:
mysql-gp2
that we created in the Define Storageclass section.Percona Xtrabackup is used in the template to clone source MySQL server to its followers.
Copy/Paste the following commands into your Cloud9 Terminal.
cd ${HOME}/environment/ebs_statefulset
wget https://eksworkshop.com/beginner/170_statefulset/statefulset.files/mysql-statefulset.yaml
Create the StatefulSet
“mysql” by running the following command.
kubectl apply -f ${HOME}/environment/ebs_statefulset/mysql-statefulset.yaml
Watch the status of StatefulSet
.
kubectl -n mysql rollout status statefulset mysql
It will take few minutes for pods to initialize and have StatefulSet
created.
Open another Cloud9 Terminal and watch the progress of pods creation using the following command.
kubectl -n mysql get pods -l app=mysql --watch
You can see ordered, graceful deployment with a stable, unique name for each pod.
Press Ctrl+C to stop watching.
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-gp2
.
And now the same information from the EC2 console.
We can see the EBS volumes have been automatically encrypted by the AWS Key Management Service (KMS)