Use it when pods wait for storage or data does not persist.
Kubernetes PersistentVolumes and Claims
PersistentVolumeClaims request storage of a size and access mode; Kubernetes binds them to PersistentVolumes, usually provisioned dynamically by a StorageClass.
1. kubectl get pvc — Bound or Pending?
2. kubectl describe pvc — provisioning events.
3. StorageClass exists/default: kubectl get sc.
4. Access mode and size fit.
5. Reclaim policy correct.
PVC → StorageClass → provisioner → PV bound → mounted in pod
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 How to verify Verify boundary
Confirm the PVC is Bound and the Pod events show successful attach and mount. For zone-bound storage, confirm the Pod runs in the same zone as the volume. Check the reclaim policy before deleting a PVC holding real data.
Step 2 Common failures Narrow the fault
No default StorageClass leaves PVCs Pending forever. A ReadWriteOnce volume still attached to an old node blocks a new Pod (Multi-Attach error). Deleting a PVC with reclaim policy Delete destroys the data.
PVC Pending → no matching StorageClass/PV or provisioner problem. Access modes (RWO, RWX) must match the use. Reclaim policy Delete removes data when the PVC is deleted.
docker ps -a— containers and exit codesdocker logs <c>— container outputdocker inspect <c>— config, mounts, network, state
ReferenceWhat it is1 section · depth on demand
How it works
Dynamic provisioning calls a CSI driver to create a disk or share and a PV that represents it. With WaitForFirstConsumer, provisioning waits until a Pod is scheduled so the volume is created in the right zone. The kubelet then attaches and mounts the volume into the Pod.
ReferenceImportant terms & boundaries3 sections · depth on demand
PV/PVC basics
apiVersion: v1
kind: PersistentVolumeClaim
metadata: { name: data }
spec:
accessModes: [ReadWriteOnce]
storageClassName: fast-ssd
resources: { requests: { storage: 20Gi } }
Documented example, not captured output. kubectl get pvc,pv shows binding. Access modes: RWO (one node), ROX, RWX (shared file storage), RWOP. Reclaim policy Delete removes the volume with the PVC — use Retain for important data.
In depth
A PersistentVolumeClaim is a request for storage; a PersistentVolume is the actual disk or share; a StorageClass tells the provisioner how to create one. The claim binds to exactly one volume.
Access modes
| Mode | Meaning | Typical backends |
|---|---|---|
| ReadWriteOnce (RWO) | Mounted read-write by one node | Block disks (EBS, Azure Disk, Ceph RBD) |
| ReadWriteOncePod (RWOP) | Read-write by one Pod | CSI drivers that support it |
| ReadOnlyMany (ROX) | Read-only by many nodes | Shared filesystems, snapshots |
| ReadWriteMany (RWX) | Read-write by many nodes | NFS, CephFS, Azure Files |
RWO restricts nodes, not Pods: two Pods on the same node can both mount an RWO volume.
Reclaim policy
Delete removes the backing disk when the claim is deleted; Retain keeps it and leaves the PV in Released state for manual recovery. Production data classes should normally use Retain, or rely on snapshots and backups.
Worked check — PVC stuck in Pending
kubectl get pvc data -o wide
kubectl describe pvc data | tail -n 8
# waiting for first consumer to be created before binding → normal until a Pod uses it
# no persistent volumes available and no storage class is set → no default StorageClass
kubectl get storageclass # look for (default)
With volumeBindingMode: WaitForFirstConsumer the claim stays Pending until a Pod is scheduled; that is expected and lets the volume be created in the Pod's zone.
Common mistakes
- Using
ReadWriteOncevolumes for multi-node pods.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.