What are PersistentVolumes (PV) and PersistentVolumeClaims (PVC)?
Options
- A PV is cluster storage; a PVC is a Pod's request that binds to a PV (Correct option)
- Two kinds of network policy that control traffic between Pods
- Two types of Pod: one for storage and one for compute work
- Backup tools that copy the state of a cluster to remote storage
Answer
A PV is a piece of storage in the cluster; a PVC is a Pod's request for storage that Kubernetes binds to a PV, so data survives Pod restarts
Why
Container filesystems disappear when a Pod is replaced. For durable data (databases, uploads) Kubernetes separates the storage from the Pod:
- PV: actual storage (cloud disk like EBS or Azure Disk, NFS).
- PVC: "I need 10 GiB, ReadWriteOnce". Kubernetes finds or dynamically provisions a PV through a StorageClass and attaches it.
The Pod mounts the claim. Managed databases (RDS, Azure SQL) are often preferable to running databases in Kubernetes.
Remember
PVC asks, PV provides, data outlives Pods.