What a StorageClass Represents
A StorageClass is a cluster-scoped object that describes a 'class' or tier of storage an administrator offers, such as 'fast-ssd' or 'archive-hdd'. It names a provisioner (like ebs.csi.aws.com or the older kubernetes.io/gce-pd) and a set of provisioner-specific parameters (disk type, IOPS, filesystem type, encryption keys). Instead of admins pre-creating dozens of PVs by hand, a StorageClass lets the system create the exact right volume on demand whenever a PVC references that class, which is the foundation of dynamic provisioning.
Cricket analogy: A StorageClass is like a stadium's tiered pitch menu — 'green seamer pitch' vs 'dry turner' — where groundstaff prepare the exact pitch type requested rather than curators guessing in advance.
Default StorageClass and Volume Binding Mode
A cluster can mark one StorageClass as default via the annotation storageclass.kubernetes.io/is-default-class: 'true'; any PVC that omits storageClassName then uses it automatically. The volumeBindingMode field controls timing: Immediate provisions the volume as soon as the PVC is created, while WaitForFirstConsumer delays provisioning until a Pod using the PVC is scheduled, which is essential in multi-zone clusters so the volume is created in the same availability zone as the node the Pod lands on, avoiding cross-zone attach failures.
Cricket analogy: WaitForFirstConsumer is like not rolling the pitch until the toss decides which end teams will bowl from, ensuring preparation matches the actual match conditions rather than guessing early.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: fast-ssd
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: ebs.csi.aws.com
parameters:
type: gp3
iops: "4000"
throughput: "250"
encrypted: "true"
reclaimPolicy: Delete
allowVolumeExpansion: true
volumeBindingMode: WaitForFirstConsumerSetting allowVolumeExpansion: true on a StorageClass lets you grow a PVC later by simply editing its requests.storage field — the CSI driver resizes the underlying volume, and for many filesystems (ext4, xfs) the filesystem itself expands online without a Pod restart.
- A StorageClass defines a provisioner and parameters for creating storage on demand.
- Marking a class default means PVCs without storageClassName use it automatically.
- volumeBindingMode: WaitForFirstConsumer delays provisioning until Pod scheduling, avoiding cross-zone mismatches.
- allowVolumeExpansion enables growing PVC size after creation.
- reclaimPolicy on the StorageClass becomes the default for PVs it dynamically creates.
- Different StorageClasses can represent tiers like fast-ssd, standard-hdd, or archive-cold.
Practice what you learned
1. What is the main purpose of a StorageClass object?
2. Why is volumeBindingMode: WaitForFirstConsumer recommended in multi-zone clusters?
3. What must be set on a StorageClass to allow PVCs using it to be resized later?
4. How does a PVC choose a default StorageClass when none is specified?
Was this page helpful?
You May Also Like
Dynamic Provisioning
See how Kubernetes automatically creates storage volumes on demand via CSI provisioners instead of requiring admins to pre-create PVs.
Persistent Volumes and Claims
Learn how Kubernetes decouples storage provisioning from storage consumption using PersistentVolume and PersistentVolumeClaim objects.
Volume Snapshots
Learn how the Kubernetes VolumeSnapshot API enables point-in-time backups and cloning of PersistentVolumes via the CSI snapshot controller.