Skip to the content.

💾 Persistent Volume (PV) in Kubernetes

Definition:

A Persistent Volume (PV) is a storage resource in Kubernetes that exists independently of pods and provides durable storage for containers.


1️⃣ Key Concepts

a) Persistent Volume (PV)

b) Persistent Volume Claim (PVC)

c) StorageClass


2️⃣ How It Works (Flow)

Pod --> PVC --> PV --> Storage Backend
  1. Pod requests storage via PVC.
  2. Kubernetes finds matching PV or creates one dynamically.
  3. PV is mounted to pod.
  4. Data persists even if pod is deleted/recreated.

3️⃣ Access Modes

Mode Meaning
ReadWriteOnce Mounted as read/write by a single node
ReadOnlyMany Mounted read-only by multiple nodes
ReadWriteMany Mounted read/write by multiple nodes

4️⃣ Reclaim Policies

Policy Meaning
Retain PV and data are kept after PVC deletion
Delete PV and storage deleted when PVC deleted
Recycle PV is cleaned and reused

5️⃣ Analogy

Think of PV like a hard drive and PVC like a request to rent that hard drive:


💡 Key takeaway:


💡 Persistent Volume Claim (PVC) in Kubernetes

Definition:

A Persistent Volume Claim (PVC) is a request for storage by a pod. It specifies size, access mode, and storage class, and Kubernetes binds it to a suitable Persistent Volume (PV).


1️⃣ How PVC Works

  1. Pod needs storage → defines a PVC in its spec.
  2. Kubernetes looks for a matching PV (capacity, access mode, storage class).
  3. If a match is found, PV is bound to PVC.
  4. Pod mounts PVC → can read/write data.

Flow (Text Diagram):

Pod --> PVC --> PV --> Storage Backend

2️⃣ Key Fields in PVC

Field Description
resources.requests.storage Amount of storage requested (e.g., 10Gi)
accessModes Read/write permissions (ReadWriteOnce, ReadOnlyMany, ReadWriteMany)
storageClassName Type of storage / provisioner (e.g., fast SSD, standard HDD)

3️⃣ Dynamic vs Static Provisioning


4️⃣ Benefits


5️⃣ Analogy

Think of PVC like a storage rental request:


💡 Key takeaway: