PersistentVolume (PV)
1 June 2025 (Updated 1 June 2025)
What is a PersistentVolume (PV)?
PersistentVolume
(PV) is a storage resource that represents an actual disk in the cluster (e.g., DigitalOcean block storage or AWS EBS).
Example PersistentVolume YAML
apiVersion: v1
kind: PersistentVolume
metadata:
name: my-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /mnt/data
spec
capacity.storage
: Tells K8s how much capacity this storage volume has.accessModes
: Defines how the volume can be mounted by pods. Available values are:ReadWriteOnce
– only one node can mount it for read/write (most common).ReadOnlyMany
– multiple nodes can mount it in read-only mode.ReadWriteMany
– Multiple nodes can mount it in read & write mode. Rare and only supported by some storage types.
hostPath.path
: Tells K8s where the data for the volume lives on the node’s filesystem.hostPath
is typically used only for local clusters like Minikube. In production, you’d store the volume data in an external service like AWS EBS.
Tagged:
Kubernetes