Day 62: PV, PVC, StorageClass
Decoupling "I need storage" from "here is storage"
A PersistentVolume (PV) represents an actual piece of storage in the cluster (an EBS volume, an NFS share, a local disk). A PersistentVolumeClaim (PVC) is a request from a Pod for storage matching certain criteria (size, access mode) — Kubernetes binds the claim to a matching PV, without the Pod ever needing to know the underlying storage technology.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: db-storage
spec:
accessModes: [ReadWriteOnce]
resources:
requests:
storage: 10Gi
storageClassName: fast-ssdA StorageClass describes a "type" of storage available (e.g. fast-ssd, standard-hdd) and, critically, which provisioner creates volumes on demand for that class — this is what makes dynamic provisioning (tomorrow) possible instead of an admin manually pre-creating PVs.
Key terms
- PersistentVolume (PV)
- A piece of actual cluster storage.
- PersistentVolumeClaim (PVC)
- A request for storage that Kubernetes binds to a matching PV.
- StorageClass
- Defines a storage "type" and which provisioner creates volumes for it on demand.
Why does a PVC let you decouple your application manifests from the underlying storage technology?