
- 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
1 — List StorageClasses
To list StorageClasses available in the cluster:(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 thefast StorageClass to view its key fields:
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:
fast StorageClass uses WaitForFirstConsumer, the PVC will remain in Pending until a Pod that mounts it is scheduled:
4 — Attach a Pod to the PVC
Create a Pod manifest that mounts the PVC:Pending to Bound:
5 — Demonstrate a Retain reclaim policy (archive)
Inspect the archive StorageClass:
archive (500Mi):
claimName: archive-storage). After creating the Pod, the PVC becomes Bound and a PV appears.
Check PVCs and PVs:
Retain StorageClass:
Retain, the PV is not deleted. Instead, it transitions to Released after the binding is removed. Watch the PV:
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
Retainfor stateful workloads where you must preserve data (databases, critical workloads). - Use
Deletefor ephemeral workloads that should be cleaned up automatically. - Prefer
WaitForFirstConsumerin 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
AllowVolumeExpansionwhen 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.