Skip to main content
This lesson assumes a PersistentVolume (PV) already exists in the cluster. Here we create a PersistentVolumeClaim (PVC) to request and consume that storage from a Pod. PersistentVolumes and PersistentVolumeClaims are separate Kubernetes objects with distinct responsibilities:
  • Administrators create and manage PersistentVolumes (PV).
  • Users create PersistentVolumeClaims (PVC) to request storage.
  • Kubernetes binds a PVC to a matching PV based on capacity, access modes, storage class, and other properties.

How binding works

A PVC is bound to a single PV. During binding, Kubernetes searches for a PV that:
  • Has sufficient capacity for the requested storage.
  • Supports the requested accessModes.
  • Matches other requested properties such as volumeMode and storageClass.
If multiple PVs match, Kubernetes picks one automatically. If you must bind a PVC to a specific PV, use labels on the PV and a selector on the PVC: PV (metadata.labels) example:
PVC (spec.selector) example:
A presentation slide titled "Binding" showing several colorful rounded rectangles labeled "PVC" and "PV" (with small database icons) illustrating persistent volume claim-to-volume bindings. Four buttons at the bottom read "Sufficient Capacity", "Access Modes", "Volume Modes", and "Storage Class."
Kubernetes will bind a smaller claim to a larger PV if all other criteria match and there are no better-fitting PVs. There is a strict one-to-one relationship between a bound PVC and a PV — remaining capacity on a PV is not shared with other claims. If no suitable PV exists, the PVC remains in the Pending state until a matching PV is created or dynamically provisioned.

Creating a PersistentVolumeClaim

Steps to create a PVC:
  1. Create a new YAML file for the PVC.
  2. Set apiVersion: v1 and kind: PersistentVolumeClaim.
  3. Provide metadata.name (for example myclaim).
  4. Under spec, set accessModes and resources.requests.storage.
Example PVC definition (pvc-definition.yaml):
Create the PVC and inspect it:
If a matching PV exists (for example, a PV with 1Gi and ReadWriteOnce), Kubernetes will bind the PVC to that PV even though the PV is larger than the requested 500Mi. Example PV definition (previously created as pv-definition.yaml):
Note: persistentVolumeReclaimPolicy is set on the PV (not the PVC) and controls what happens to the PV after its bound PVC is deleted. Also note: The awsElasticBlockStore example above is an in-tree volume plugin example. Many in-tree cloud plugins have been superseded by CSI drivers and dynamic provisioning through StorageClasses. Prefer CSI-backed volumes or dynamically provisioned PVs when possible. After binding, confirm status:

Deleting a PVC and reclaim policy behavior

To delete a claim:
What happens to the underlying PV depends on its persistentVolumeReclaimPolicy. Common policies:
Recycle is deprecated. Use dynamic provisioning with StorageClasses and CSI drivers for provider-supported lifecycle and cleanup operations instead of relying on the old recycle behavior.

Why recycle was deprecated

  • The old recycler performed a best-effort file delete and could not guarantee secure erasure.
  • It did not handle snapshots, provider metadata, or encrypted volumes correctly.
  • It worked only for some in-tree volume plugins.
  • Proper cleanup typically requires unmount/detach, filesystem reformat, snapshot handling, or provider-level deletes — operations the recycler did not perform reliably.
Use StorageClasses and CSI drivers for dynamic provisioning and lifecycle management:
  • StorageClasses let Kubernetes dynamically create PVs with specified parameters.
  • CSI drivers (or cloud provisioners) handle creation, deletion, and advanced lifecycle operations such as snapshots, encryption, and resizing.
  • Dynamic provisioning avoids manual PV creation and reduces administrative overhead.

Quick reference & next steps

  • Use a selector if you must bind a PVC to a specific PV by label.
  • Prefer dynamic provisioning via StorageClass + CSI for cloud or production workloads.
  • Inspect kubectl get pv,pvc and kubectl describe pv <name> / kubectl describe pvc <name> when troubleshooting binding problems.
Links and references That’s it for this lesson. Practice creating, binding, and deleting PVCs and PVs in a test cluster to become familiar with lifecycle behavior and troubleshooting.

Watch Video