Kubernetes StorageClasses

Use StorageClasses for dynamic provisioning and learn how provisioners, reclaim policies, and volume binding modes affect storage behavior.

What Does a StorageClass Do?

A StorageClass defines how Kubernetes should dynamically provision storage when a PVC asks for it.

Without a StorageClass, you may need to create PVs manually. With one, the cluster can often provision storage automatically.

Key Fields

FieldMeaning
provisionerPlugin or driver that creates storage
reclaimPolicyWhat happens after release
volumeBindingModeWhen binding and provisioning happen

Full YAML Example

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: fast-ssd
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
provisioner: ebs.csi.aws.com
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
parameters:
  type: gp3

Why WaitForFirstConsumer Matters

This mode delays provisioning until Kubernetes knows where the pod will run. That can help with topology-aware storage decisions.

Cloud Examples

CloudExample provisioner idea
AWSEBS CSI driver
GCPPersistent Disk CSI driver

List StorageClasses

kubectl get storageclass

Default StorageClass

Clusters can mark one StorageClass as default. Then a PVC that does not name a class can still be dynamically provisioned.

Think of a StorageClass as a storage policy template. It says what kind of disk to create and how it should behave, without forcing every app team to know the infrastructure details.

Exercise

Main Benefit

What is the main benefit of a StorageClass?

Exercise

Default Meaning

What does marking a StorageClass as default usually do?

Continue Learning

Explore Related Topics

Try the Tool

Related Resources