Persistent Volumes and PersistentVolumeClaims

Understand the PV and PVC model, access modes, reclaim policies, and how a pod mounts durable storage through a claim.

PV and PVC in Plain English

A PersistentVolume (PV) is storage available to the cluster. A PersistentVolumeClaim (PVC) is a request for some of that storage from within a namespace.

Scope Difference

ResourceScope
PVCluster-level
PVCNamespace-level

Binding Lifecycle

StateMeaning
AvailablePV exists and is not yet claimed
BoundPVC is attached to a PV
ReleasedClaim was removed but PV handling is not finished
FailedBinding or reclaim operation failed

Access Modes

ModeMeaning
RWOReadWriteOnce
ROXReadOnlyMany
RWXReadWriteMany

Reclaim Policies

PolicyEffect
RetainKeep storage for manual cleanup or reuse
DeleteRemove underlying storage when released
RecycleLegacy pattern, rarely used now

Full YAML Example

apiVersion: v1
kind: PersistentVolume
metadata:
  name: demo-pv
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  hostPath:
    path: /data/demo-pv
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: demo-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
---
apiVersion: v1
kind: Pod
metadata:
  name: pvc-demo
spec:
  containers:
    - name: app
      image: busybox:1.36
      command: ['sh', '-c', 'echo hello > /data/hello.txt && sleep 3600']
      volumeMounts:
        - name: data
          mountPath: /data
  volumes:
    - name: data
      persistentVolumeClaim:
        claimName: demo-pvc

Binding Diagram

Pod → PVC → PV → Storage backend

Pod

mounts /data

PVC

claim · namespace

requests: 10Gi RWO

binds to

PV

cluster-wide resource

capacity: 50Gi

Storage

AWS EBS / GCP PD

NFS / hostPath

AvailableBoundReleasedFailed

PV lifecycle phases

Why PVCs Are Better for App Teams

Developers usually should not hardcode infrastructure details. A PVC lets them ask for storage by size and capabilities, while platform teams manage the backing implementation.

Exercise

Scope Check

Which statement about scope is correct?

Exercise

Retain Policy

What does the `Retain` reclaim policy generally mean?

Continue Learning

Explore Related Topics

Try the Tool

Related Resources