EKS with gp3 volumes

AWS encourages users to migrate from gp2 to gp3 for better performance and lower costs.

Simplified(very) comparison gp2 vs. gp3

Feature gp2 gp3
Base Price (per GB) $0.10 $0.08 (20% cheaper)
IOPS per GB 3 IOPS/GB (size-dependent) 3,000 IOPS included (fixed)
Max IOPS 16,000 16,000 (provisioned)
Max Throughput 250 MB/s (size-dependent) 1,000 MB/s (provisioned)
IOPS Scaling Scales with size Provisioned independently
Use Cases Simpler workloads, costlier for small IOPS needs Higher performance at a lower price

As a prerequisite it needs ebs-csi-controller, it can be installed with eksctl

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
#<...>

addons:
#<...>
- name: aws-ebs-csi-driver
  resolveConflicts: overwrite
  configurationValues: |-
    controller:
      nodeSelector:
        label: value

#<...>  

New StorageClass for gp3 must be created:

1
2
3
4
5
6
7
8
9
cat > gp3.yaml<<EOF
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: gp3
provisioner: ebs.csi.aws.com
volumeBindingMode: WaitForFirstConsumer
EOF

.. and deployed:

1
kubectl apply -f gp3.yaml

Switch default StorageClass from gp2 to gp3

1
2
3
4
#unset default flag for gp2
kubectl patch storageclass gp2 -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
#set default flag for gp3
kubectl patch storageclass gp2 -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'