Persistent Volumes (PV)ΒΆ
OverviewΒΆ
A Persistent Volume (PV) is a cluster-wide resource that provides storage.
It represents actual storage provisioned from:
- Local disks
- Network storage (NFS)
- Cloud providers (AWS EBS, Azure Disk, etc.)
Key CharacteristicsΒΆ
- Exists independently of Pods
- Managed by Kubernetes or an administrator
- Has a defined capacity and access mode
Example PVΒΆ
apiVersion: v1
kind: PersistentVolume
metadata:
name: example-pv
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /data
Access ModesΒΆ
- ReadWriteOnce (RWO) - Mounted by a single node
- ReadOnlyMany (ROX) - Read-only by multiple nodes
- ReadWriteMany (RWX) - Read/write by multiple nodes
LifecycleΒΆ
graph TD
Available --> Bound
Bound --> Released
Released --> Available
- Available - Not yet claimed
- Bound - Connected to a PVC
- Released - Claim deleted but not yet reusable
Static vs Dynamic ProvisioningΒΆ
StaticΒΆ
- Admin manually creates PVs
DynamicΒΆ
- Kubernetes creates PVs automatically using StorageClasses
Real-World ImplicationsΒΆ
- Storage can outlive Pods
- Data is preserved across failures
- Enables stateful applications (databases, queues)
Key TakeawaysΒΆ
- PVs represent actual storage resources
- They are independent of Pods
- They are consumed via PVCs