Storage
The Storage domain tests persistent and ephemeral volumes: PersistentVolumes, PersistentVolumeClaims, StorageClasses, access modes, and mounting claims into Pods. You should be able to create a claim, bind it, mount it, and explain why a claim is Pending.
Core rules
- A PV is cluster-scoped storage; a PVC is namespaced and requests size, access mode, and optionally a StorageClass. Binding is one-to-one.
- Access modes: ReadWriteOnce (RWO) is typically one node, ReadOnlyMany (ROX) many nodes read-only, ReadWriteMany (RWX) many nodes read-write, ReadWriteOncePod (RWOP) one Pod. Support depends on the volume plugin.
volumeBindingMode: WaitForFirstConsumerdelays binding until a Pod uses the PVC, so the PV can match the Pod's node topology.- Reclaim policies: Delete removes the backend volume; Retain keeps it and requires manual cleanup.
- StatefulSets use
volumeClaimTemplatesto give each replica its own PVC. ConfigMap and Secret volumes project keys as files; emptyDir lasts for the Pod's lifetime.
Worked example
A Pod mounts PVC data and stays Pending. kubectl describe pvc data shows no persistent volumes available for this claim and no storage class is set. The PVC requests 5Gi RWO but no matching PV exists. The fix is either to create a PV of at least 5Gi with matching access mode and storageClassName, or to set a valid StorageClass on the PVC so dynamic provisioning can create one. The reasoning: the scheduler cannot place a Pod whose PVC is unbound, because the volume may be topology-constrained. After binding, kubectl get pvc shows Bound and the Pod schedules.
Traps
- A PVC can only bind to a PV in the same StorageClass; an empty
storageClassNamedoes not match a class unless the PV also has none. - RWO is not a file-locking guarantee for every plugin; it is enforced per node for many block volumes.
- Changing a PVC's size works only if the StorageClass has
allowVolumeExpansion: true. - Deleting a PVC with a Retain PV leaves the PV Released; it will not rebind without clearing
claimRef. - A Pod using a missing ConfigMap or Secret volume can be scheduled but fail to start; check events, not just PVC status.