Creating an EBS storage class

Let's perform the following steps to learn the storage class parameters required to construct an EBS storage class that we can use to dynamically request new persistent volumes from AWS Cloud:

  1. Create a basic storage class with the provisioner, kubernetes.io/aws-ebs, and gp2 type specified:
$ cat <<EOF | kubectl apply -f -
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: aws-gp2
provisioner: kubernetes.io/aws-ebs
parameters:
type: gp2
fsType: ext4
reclaimPolicy: Retain
allowVolumeExpansion: true
mountOptions:
- debug
volumeBindingMode: Immediate
EOF

Other type values accepted here include io1, sc1, and st1. You can find the definition and use cases for different volume types on the AWS EBS volume types link in the See also section.

On Amazon EKS clusters, the default EBS volume type is gp2. For database workloads, such as MongoDB, Cassandra, and PostgreSQL, io1-type, high-performance SSDs are recommended.
  1. List the storage classes. Confirm that you have new aws-gp2 on the list. Depending on the cloud provider or Kubernetes deployment tool, you may see other storage classes on the list similar to the following:
$ kubectl get sc
NAME PROVISIONER AGE
aws-gp2 kubernetes.io/aws-ebs 8s
default kubernetes.io/aws-ebs 25h
gp2 (default) kubernetes.io/aws-ebs 25h
openebs-hostpath openebs.io/local 175m
openebs-jiva-default openebs.io/provisioner-iscsi 175m

Storage classes are the foundation of dynamic provisioning. As you can see in our example, you may have more than one storage class in your cluster. Ideally, storage classes should be created with an application's requirements in mind, since certain applications require faster volumes, while others may take advantage of multi-availability zone replication provided by solutions such as Rook and OpenEBS, which we will deploy later in this chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.30.19