Skip to main content
Every application that stores data needs storage. In Kubernetes, workloads request storage through StorageClasses, which define how PersistentVolumes (PVs) are provisioned and managed. Think of a StorageClass as the platform’s storage menu: fast SSD-backed volumes for databases, cost-effective spinning disks for archives, cloud block storage provisioned on demand, or replicated volumes for production workloads. Teams pick what they need and Kubernetes handles provisioning.
A presentation slide showing "Demo" on the left and a large blue curved shape on the right with the title "Storage Classes in Action." A small "© Copyright KodeKloud" appears in the bottom-left corner.
This guide walks through:
  • Listing StorageClasses
  • Inspecting important StorageClass fields
  • Creating PVCs that request specific StorageClasses
  • Attaching Pods to those PVCs
  • Observing how reclaim policies affect the PV lifecycle
References:

1 — List StorageClasses

To list StorageClasses available in the cluster:
Sample output:
Note the (default) annotation on local-path. If a PVC does not explicitly request a storageClassName, it will be provisioned using the default StorageClass.

2 — Inspect a StorageClass (example: fast)

Describe the fast StorageClass to view its key fields:
Example (trimmed) output:
Key fields explained: Reclaim policy and volume binding behavior are crucial for correctness and cost control:

3 — Create a PVC using the fast StorageClass

This PVC requests 1Gi and specifies storageClassName: fast:
Apply it:
Because the fast StorageClass uses WaitForFirstConsumer, the PVC will remain in Pending until a Pod that mounts it is scheduled:
Example (Pending):

4 — Attach a Pod to the PVC

Create a Pod manifest that mounts the PVC:
Apply the Pod:
Watch the PVC transition from Pending to Bound:
Sample transition (trimmed):
A PV is dynamically provisioned and bound to the PVC. Verify the PV:
Example PV output:

5 — Demonstrate a Retain reclaim policy (archive)

Inspect the archive StorageClass:
Example (trimmed):
Create a PVC that uses archive (500Mi):
Apply the PVC and attach a Pod (Pod manifest similar to the previous one, using claimName: archive-storage). After creating the Pod, the PVC becomes Bound and a PV appears. Check PVCs and PVs:
Example outputs showing both PVs:
Now delete the PVC that used the Retain StorageClass:
Because the reclaim policy is Retain, the PV is not deleted. Instead, it transitions to Released after the binding is removed. Watch the PV:
Example PV state change:
When a PV is Released, the underlying data remains on the volume. An administrator must manually inspect, scrub, or reclaim that volume before it can be reused.

6 — Quick reference and recommendations

Quick commands: Best practices when choosing a StorageClass:
  • Use Retain for stateful workloads where you must preserve data (databases, critical workloads).
  • Use Delete for ephemeral workloads that should be cleaned up automatically.
  • Prefer WaitForFirstConsumer in multi-zone clusters to avoid provisioning volumes in the wrong zone.
  • Choose the right access mode: ReadWriteOnce (RWO), ReadWriteMany (RWX) depending on application needs.
  • Verify AllowVolumeExpansion when you expect to grow volumes after initial provisioning.
When preparing for an exam or designing a cluster, always list your StorageClasses and inspect their reclaimPolicy and volumeBindingMode. These fields determine if storage is provisioned immediately or later, where it will be provisioned, and what happens to the backing storage when a PVC is deleted.

Watch Video

Practice Lab