Dynamic Volume Provisioning allows storage volumes to be created on-demand. StorageClass should be pre-created to define which provisoner should be used and what parameters should be passed when dynamic provisioning is invoked. (See parameters for AWS EBS)
Copy/Paste the following commands into your Cloud9 Terminal.
mkdir ~/environment/templates
cd ~/environment/templates
wget https://eksworkshop.com/beginner/170_statefulset/storageclass.files/mysql-storageclass.yml
Check the configuration of mysql-storageclass.yml file by following command.
cat ~/environment/templates/mysql-storageclass.yml
You can see provisioner is kubernetes.io/aws-ebs and type is gp2 specified as a parameter.
Create storageclass “mysql-gp2” by following command.
kubectl create -f ~/environment/templates/mysql-storageclass.yml
We will specify “mysql-gp2” as the storageClassName in volumeClaimTemplates at “Create StatefulSet” section later.