Pcornel
Browse topics
Options
Recent
Favorites
Containers · Technical reference

Kubernetes PersistentVolumes and Claims

Direct answer

PersistentVolumeClaims request storage of a size and access mode; Kubernetes binds them to PersistentVolumes, usually provisioned dynamically by a StorageClass.

When to use this

Use it when pods wait for storage or data does not persist.

First 30 seconds

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.

Operational verification

PVC → StorageClass → provisioner → PV bound → mounted in pod

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Docker / containerd / Podman / Kubernetes / OCI-compatible platforms
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformDocker / containerd / Podman / Kubernetes / OCI-compatible platforms
Scope / prerequisiteUse it when pods wait for storage or data does not persist.
What next?2 suggested next steps
Evidence0
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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.

Key points

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.

Key checks
  • docker ps -a — containers and exit codes
  • docker logs <c> — container output
  • docker 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

ModeMeaningTypical backends
ReadWriteOnce (RWO)Mounted read-write by one nodeBlock disks (EBS, Azure Disk, Ceph RBD)
ReadWriteOncePod (RWOP)Read-write by one PodCSI drivers that support it
ReadOnlyMany (ROX)Read-only by many nodesShared filesystems, snapshots
ReadWriteMany (RWX)Read-write by many nodesNFS, 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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Common mistakes

  • Using ReadWriteOnce volumes for multi-node pods.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terminology layer

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.

Aliases that resolve here
kubernetes persistentvolumes and claimspersistentvolumeclaim pendingkubernetes storageclass
Confirmation

Confirm action

Continue?