Skip to main content

Persistent Volume Claims

Why PVCs Were Born

Picture a massive warehouse (Persistent Volume). It’s full of resources, but workers (pods) can’t just walk in and grab what they want - they need a key that grants them access to the right section. Kubernetes faced the same challenge: pods needed a way to request storage without knowing the details of the underlying infrastructure.

Persistent Volume Claims (PVCs) were born as the keys to Kubernetes warehouses, allowing pods to request storage in a declarative, consistent way.


PVCs - Storage Lifecycle

  • Pod Requests Storage: A pod doesn’t directly talk to a Persistent Volume.
  • PVC Acts as a Bridge: The pod requests a PVC, which then binds to a suitable PV.
  • Dynamic Provisioning: If no PV exists, Kubernetes can create one automatically using a StorageClass.
  • Decoupling: Pods don’t care if the storage is local disk, cloud volume, or network file system - the PVC abstracts it away.

Analogy: PVCs are like rental agreements - you don’t own the warehouse, but you get guaranteed access to the space you need.


Technical Core

  • Access Modes:
    • ReadWriteOnce – Mounted by a single node.
    • ReadOnlyMany – Multiple nodes can read.
    • ReadWriteMany – Multiple nodes can read/write simultaneously.
  • Binding: PVCs bind to PVs that match their size and access requirements.
  • StorageClasses: Define how volumes are provisioned dynamically (e.g. AWS EBS, GCP PD, Azure Disk).

Global Context

  • Enterprises: PVCs power databases, analytics pipelines, and stateful applications.
  • Cloud Providers: PVCs integrate with cloud storage backends, enabling hybrid and multi‑cloud persistence.
  • Community: PVCs are taught worldwide as the developer‑friendly way to request storage in Kubernetes.

Hands‑On Exercise

  1. Reflect: How does the PVC act as a bridge between pods and persistent storage?

Attach PVC to a pod:

apiVersion: v1
kind: Pod
metadata:
  name: pod-demo
spec:
  containers:
  - name: app
    image: nginx
    volumeMounts:
    - mountPath: "/usr/share/nginx/html"
      name: storage
  volumes:
  - name: storage
    persistentVolumeClaim:
      claimName: pvc-demo
kubectl apply -f pod.yaml
kubectl get pods

Create a PVC:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-demo
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
kubectl apply -f pvc.yaml
kubectl get pvc

The Hacker’s Notebook

  • PVCs are keys - granting pods access to storage.
  • Access modes define how storage is shared.
  • StorageClasses enable dynamic provisioning - cloud‑native persistence at scale.
  • Lesson for engineers: Don’t hard‑wire storage - use PVCs for flexibility.
  • Hacker’s mindset: Treat PVCs as your contracts. With them, you can run databases, analytics, and stateful apps across clusters and clouds.

Tips, Tricks, Roadmaps, Resources, Networking, Motivation, Guidance, and Cool Stuff ♥

Updated on Dec 29, 2025