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 slaves.
Copy/Paste the following commands into your Cloud9 Terminal.
cd ~/environment/templates
wget https://eksworkshop.com/beginner/170_statefulset/statefulset.files/mysql-statefulset.yml
Create the StatefulSet “mysql” by following command.
kubectl create -f ~/environment/templates/mysql-statefulset.yml
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,data-mysql-1, and data-mysql-2 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)
