Skip to main content
Course/Storage & Ingress/PersistentVolumes β€” Storage Lifecycle
6/760 min
Storage & Ingress

PersistentVolumes β€” Storage Lifecycle

Decouple storage from pods: PersistentVolumes, PersistentVolumeClaims, and StorageClasses for dynamic provisioning.

intermediate60 minRead β†’ Lab β†’ Quiz β†’ Practice
🧠 Brain Warm-Up
🧠 Brain Warm-Up: A pod crashes and is rescheduled to a different node. An emptyDir volume is gone. A hostPath volume might have data on the wrong node. What storage abstraction would let the pod resume with the same data regardless of which node it lands on?

The Storage Abstraction Stack

Pod
 └── Volume (PVC reference)
      └── PersistentVolumeClaim (namespace-scoped request)
           └── PersistentVolume (cluster-scoped actual storage)
                └── Storage backend (NFS, cloud disk, hostPath...)

PV: Cluster-scoped storage resource. Provisioned by an admin or dynamically.

PVC: Namespace-scoped claim by a workload. Specifies size, access mode, StorageClass.

StorageClass: Defines a provisioner. Enables dynamic PV creation on demand.

Binding

PVC binding is automatic when a PV matches:

  1. PVC requested size ≀ PV capacity
  2. Access modes overlap
  3. StorageClass matches (or both empty)

Once bound, the PVC and PV are exclusive to each other.

Access Modes

ModeShortMeaning
ReadWriteOnceRWOOne node, read+write
ReadOnlyManyROXMany nodes, read-only
ReadWriteManyRWXMany nodes, read+write

Most cloud block devices only support RWO. NFS supports RWX.

Reclaim Policies

PolicyAfter PVC deleted
RetainPV stays, data kept, must manually reclaim
DeletePV and backing storage deleted
RecycleDeprecated β€” rm -rf then reuse

Dynamic Provisioning with StorageClass

Instead of pre-creating PVs, a StorageClass provisions them on demand:

PVC created β†’ StorageClass provisioner creates PV β†’ PVC binds to PV

minikube has a default StorageClass (standard) backed by hostPath.