AWS EBS StorageClasses
What you'll learn: How to create StorageClasses in Kubernetes that provision different types of AWS EBS volumes (gp2, gp3, io1, io2) for your workloads.
Understanding EBS Volume Types
When running Kubernetes on AWS (EKS or self-managed), you can dynamically provision Elastic Block Store (EBS) volumes as PersistentVolumes. AWS offers several EBS volume types, each optimized for different performance and cost profiles:
- gp2/gp3 (General Purpose SSD): Balanced price/performance for most workloads
- io1/io2 (Provisioned IOPS SSD): High-performance for I/O-intensive databases
- st1 (Throughput Optimized HDD): Low-cost for big data workloads
- sc1 (Cold HDD): Lowest cost for infrequently accessed data
Think of these like different car models: gp3 is your reliable sedan, io2 is a sports car for speed, and sc1 is an economical compact for occasional use.
Creating EBS StorageClasses
Each StorageClass defines which EBS volume type to provision:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: fast-ssd
provisioner: ebs.csi.aws.com
parameters:
type: io2
iopsPerGB: "50"
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
The provisioner uses the AWS EBS CSI driver, and parameters.type specifies the EBS volume type. For io1/io2, you must also specify IOPS requirements.
Common Parameter Options
- type: gp2, gp3, io1, io2, st1, sc1
- encrypted: "true" for encryption at rest
- iopsPerGB: IOPS for io1/io2 volumes
- fsType: Filesystem type (ext4, xfs)
Key Takeaway: AWS EBS StorageClasses let you define which EBS volume type to provision dynamically, matching storage performance and cost to your application's specific needs using the parameters.type field.