Skip to main content
Every application that stores data needs storage. On Kubernetes, workloads request storage via PersistentVolumeClaims (PVCs), and the cluster provisions storage according to a StorageClass. Think of a StorageClass as a platform-provided menu of storage options: fast SSDs for databases, cheap spinning disks for archival data, cloud block volumes, or replicated storage for production workloads. Teams request the option they need and Kubernetes handles provisioning. This guide shows how to:
  • List and inspect StorageClasses
  • Demonstrate dynamic provisioning using a StorageClass (fast)
  • Compare reclaim behaviors (Delete vs Retain)
  • Apply best practices for production clusters
Keywords: Kubernetes StorageClass, dynamic provisioning, reclaim policy, PVC, PV, WaitForFirstConsumer

List available StorageClasses

Get the StorageClasses in the cluster:
Example output:
Note: The cluster’s default StorageClass (if set) is indicated by an annotation/marker in some kubectl get sc output. If a PVC omits storageClassName, Kubernetes uses the default StorageClass automatically (if one exists).
If a PVC does not set storageClassName, Kubernetes assigns the default StorageClass (if one exists). This behavior is important in production clusters to avoid unexpected storage types being provisioned.

Inspect a StorageClass

To view details for the fast StorageClass:
Example output (trimmed):
Key StorageClass fields and what they mean: Volume binding mode note: WaitForFirstConsumer delays provisioning until a Pod using the PVC is scheduled — this avoids provisioning in the wrong zone/node and is highly recommended in multi-zone clusters.

Demonstrate dynamic provisioning (fast StorageClass)

Create a PVC that requests 1Gi using the fast StorageClass. Save this as pvc-fast.yaml:
Apply the PVC:
Watch the PVC in the storage namespace:
Because VolumeBindingMode is WaitForFirstConsumer, the PVC will initially be Pending until a Pod mounts it. Create a Pod that consumes the PVC to trigger provisioning:
After scheduling, the PVC should transition from Pending to Bound:
A PV is created dynamically to satisfy the claim:
Example:
Explanation: Because the fast StorageClass has ReclaimPolicy: Delete, the underlying storage will be deleted automatically when the PVC (and its binding) is removed.

Demonstrate reclaim policy difference: Retain (archive StorageClass)

The archive StorageClass in this cluster uses ReclaimPolicy: Retain. Create a PVC using that class. Save this as pvc-archive.yaml:
Apply it:
Create a Pod that mounts the archive-storage claim:
After scheduling, the PVC will bind and a PV will be provisioned for the archive StorageClass. The PV will show RECLAIM POLICY: Retain:
Example (trimmed):

What happens on deletion with different reclaim policies

  1. For fast (ReclaimPolicy: Delete)
    • Delete the Pod and the PVC:
    • Result: The PV and the underlying storage resource are deleted automatically.
  2. For archive (ReclaimPolicy: Retain)
    • Delete the Pod, then delete the PVC:
    • Result: The PV remains in the cluster and moves to Released state. The underlying data is preserved and requires administrator action to reclaim or reuse the volume.
Example after deleting a PVC for a Retain PV:
Example output:
When a PV is Released with Retain, an administrator must:
  • Inspect and back up data if needed
  • Clean or wipe data to make the volume reusable
  • Remove or update claimRef on the PV to allow re-binding
  • Or manually delete the underlying storage resource
Choose reclaim policies based on workload needs:
  • Use Retain for critical, stateful workloads (databases, logs) to prevent accidental data loss.
  • Use Delete for ephemeral or test workloads to automate cleanup. Also confirm correct access modes (ReadWriteOnce, ReadWriteMany) and zone affinity by using WaitForFirstConsumer in multi-zone clusters.

Recap / Best practices

  • Inspect StorageClasses before creating PVCs:
    • kubectl get sc and kubectl describe sc <name>
  • Understand reclaim behavior:
    • Delete — automated cleanup
    • Retain — manual intervention required
  • Use WaitForFirstConsumer to avoid cross-zone provisioning in multi-zone clusters.
  • Prefer explicitly setting storageClassName in PVCs unless you intentionally rely on a default StorageClass.
  • Confirm access modes and size requirements match application needs.
  • Monitor resource lifecycle:
    • kubectl get pvc -n <ns> -w
    • kubectl get pv
Explore your cluster’s StorageClasses, create PVCs and Pods, and observe how Kubernetes dynamically provisions and manages storage according to StorageClass settings.

Watch Video

Practice Lab