Kubernetes StorageClass is a Kubernetes resource that defines how persistent storage should be provisioned for PersistentVolumeClaims, or PVCs. It lets platform teams offer different storage options, such as fast SSD disks, cheaper standard disks, encrypted volumes, or zone-aware storage, without requiring application teams to know the underlying cloud or storage details.
A StorageClass acts as a storage profile inside a Kubernetes cluster. When a developer creates a PVC and references a StorageClass, Kubernetes uses that class to create or bind a PersistentVolume with the right settings.
For example, a cluster might provide these classes:
This gives application teams a simple interface: request storage by class, size, and access mode. The platform handles the storage backend configuration.
A StorageClass connects Kubernetes to a storage provisioner. The provisioner is usually a Container Storage Interface, or CSI, driver provided by a cloud provider or storage vendor.
Common examples include:
When a PVC requests a StorageClass, Kubernetes follows this flow:
fast-ssd StorageClass.A typical StorageClass includes several fields that control provisioning behavior.
ebs.csi.aws.com.Delete and Retain.WaitForFirstConsumer is often safer for zonal storage because it waits until a Pod is scheduled.Here is a basic AWS EBS StorageClass example:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: gp3
provisioner: ebs.csi.aws.com
parameters:
type: gp3
fsType: ext4
reclaimPolicy: Delete
allowVolumeExpansion: true
volumeBindingMode: WaitForFirstConsumer
A PVC can then request this class:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-data
spec:
accessModes:
- ReadWriteOnce
storageClassName: gp3
resources:
requests:
storage: 100Gi
In this example, Kubernetes creates a 100 GiB EBS gp3 volume when the PVC is used by a Pod. The application does not need AWS API calls or direct disk provisioning logic.
These three Kubernetes concepts work together, but they solve different problems.
You can think of a PVC as the request, a StorageClass as the provisioning policy, and a PersistentVolume as the resulting storage resource.
A cluster can have a default StorageClass. If a PVC does not specify storageClassName, Kubernetes can assign the default class automatically.
This is convenient, but it can also hide important decisions. For production clusters, many teams define explicit StorageClass names in workload manifests so storage behavior remains predictable across environments.
For example, a staging cluster might use cheaper standard disks, while production uses encrypted SSD-backed volumes. If both clusters rely on a default class with different behavior, the same manifest may produce different storage characteristics.
WaitForFirstConsumer to reduce scheduling conflicts.ReadWriteOnce, meaning one node can mount the volume for writing. Shared write access, such as ReadWriteMany, usually requires a different backend like NFS, EFS, or CephFS.Delete removes the backing volume when the PVC is deleted. Retain keeps it, which is safer for critical data but requires manual cleanup.allowVolumeExpansion depends on CSI driver and storage backend support.Platform teams often manage StorageClasses with GitOps, Helm, Terraform, or Crossplane. This keeps storage policy versioned and reviewable like other infrastructure code.
If your team manages Kubernetes resources with Terraform, this guide on deploying Kubernetes resources using Terraform shows the broader pattern. If you want Kubernetes to manage cloud resources directly, Crossplane can also provision cloud infrastructure through Kubernetes APIs, as shown in this guide to deploying AWS resources using Crossplane on Kubernetes.
Suppose your platform team runs a Kubernetes cluster for several product teams. You create three StorageClasses:
standard: general-purpose disks with automatic deletiondatabase: faster disks, volume expansion enabled, and delayed bindingretained: disks kept after PVC deletion for safer recovery during manual operationsA payments service that runs PostgreSQL requests the database class with a 200 GiB PVC. A background worker that stores temporary cache data uses standard. A migration job that handles sensitive one-time data uses retained so the volume is not deleted by accident.
This keeps storage decisions consistent while giving each workload the right level of durability, performance, and operational safety.
database, shared-files, or encrypted-retained instead of provider-specific names when possible.volumeBindingMode carefully: Use WaitForFirstConsumer for zonal block storage to help Kubernetes schedule Pods and volumes in the same zone.Kubernetes StorageClass defines the storage provisioning policy for PVCs. It lets teams request persistent storage through Kubernetes while platform engineers control the backend details, such as disk type, reclaim policy, binding behavior, encryption, and expansion support.
Used well, StorageClasses make stateful workloads easier to run consistently. Used carelessly, they can create data loss, scheduling issues, or unexpected storage costs. Treat them as part of your production infrastructure design, not as a default setting to ignore.