liveBook · Manning

Persistent volume claim

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

A persistent volume claim is a Kubernetes object that requests and reserves storage from a persistent volume.

A persistent volume claim (PVC) reserves storage for a pod without tying that storage to the pod’s lifetime. The claim requests capacity from a persistent volume (PV); once bound, that PV is unavailable to other claims. This lets an application use persistent data without managing the underlying storage directly. section 1.4.4 section 7.2

For a storage task, work from the request to the running pod:

  • Create or identify an available PV, then create a PVC requesting the needed capacity and access mode. A claim need not request the PV’s exact size: a 90 MB request can bind to a 100 MB volume. section 7.1 section 7.2
  • Mount the claimed volume in a pod or Deployment. Check the binding with `kubectl get pvc` and `kubectl get pv`, then check the workload and its mount with `kubectl get po` and `kubectl describe po`. section 7.1
  • If the task specifies an existing storage class, select it in the PVC instead of creating a PV manually; the volume can be provisioned automatically. section 7.5

Claim and verify a hostPath volume

Create a 100 MB hostPath PV backed by `/mnt/data` on a worker node, then create a PVC requesting 90 MB. Mount the claim in a Deployment at `/usr/share/nginx/html`. The resulting `kubectl get pvc` output shows the claim as `Bound` to the 100Mi PV; `kubectl get pv` shows the same binding from the volume side. section 7.1

root@kind-control-plane:/# kubectl get pvc
NAME          STATUS   VOLUME     CAPACITY   ACCESS MODES   STORAGECLASS   
 AGE
claim-02833   Bound    vol02833   100Mi      RWO            manual         
 4m
root@kind-control-plane:/# kubectl get pv
NAME       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   
 CLAIM                 STORAGECLASS
vol02833   100Mi      RWO            Retain           Bound    
 default/claim-02833   manual

Compare the PVC’s `VOLUME` and `STATUS` columns with the PV’s `CLAIM` and `STATUS` columns to confirm both sides of the binding. section 7.1

A bound claim also protects storage still in use. In the worked deletion test, forcing deletion of the PV leaves it `Terminating` until the PVC is deleted; forcing deletion of the PVC leaves it `Terminating` while the Deployment’s pod still uses it. Remove the workload before expecting the claim and volume deletion to finish. section 7.2

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Works through claim binding, capacity matching, verification, and deletion behavior without detailing storage-provider internals.
Examples
Uses a 90 MB claim bound to a 100 MB hostPath volume, plus kubectl output showing binding and blocked deletion.
What it assumes
Assumes access to a Kubernetes cluster and familiarity with pods and Deployments; supplies a cluster setup pointer if needed.
What you can do after
Build it from scratch by creating a claim, mounting it in a workload, and verifying the bound volume with kubectl.
How it connects
Connects persistent volumes and storage classes to pod mounts, access modes, and reclaim policies.

Also explained in

Compare how 9 books explain persistent volume claim →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.