What's a conceptual difference between PersistentVolume and PersistentVolumeClaim in kubernetes?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
In Kubernetes, managing storage is a critical aspect, especially as more complex applications are deployed in the cluster. Kubernetes provides a mechanism to decouple the way storage is provisioned and consumed using concepts like `PersistentVolume` (PV) and `PersistentVolumeClaim` (PVC). Understanding the conceptual difference between these two is crucial for effectively managing stateful applications in a Kubernetes environment.
Key Differences: PersistentVolume vs PersistentVolumeClaim
PersistentVolume (PV)
A `PersistentVolume` is a piece of storage in the cluster that has been provisioned by an administrator or dynamically created using StorageClasses in Kubernetes. It's an object in the cluster that encapsulates storage resource details. Here are some important attributes of a PV:
- Lifecycle Management: Unlike ephemeral volumes tied to the lifecycle of a Pod, PVs exist beyond the lifecycle of any single Pod, thus providing persistence.
- Status: PVs have statuses such as Available, Bound, Released, and Failed, indicating their current use state.
- Provisioning: Can be either statically created by an admin or dynamically by Kubernetes using a StorageClass.
- Access Modes: Defined by modes like ReadWriteOnce, ReadOnlyMany, and ReadWriteMany, specifying how the volume can be mounted by nodes.
- Reclaim Policy: Types include Retain, Recycle, and Delete, defining what happens to the volume when it is released from its claim.
PersistentVolumeClaim (PVC)
A `PersistentVolumeClaim` is a request for storage by a user. It is similar to a Pod requesting compute resources. A PVC specifies size, access modes, and possibly a specific storage class needed.
- Binding: When a PVC is created, Kubernetes searches for a PV that satisfies the request. If a suitable PV is available, Kubernetes binds it to the PVC.
- Resources: PVCs specify resource requests in terms of storage capacity and access mode requirements.
- Consumption: Once bound to a PV, a Pod can then use the PVC as a volume, accessing storage resources provided by the PV.
- Portability: PVCs abstract the underlying storage, allowing for greater flexibility and migration capabilities across different environments.
Technical Illustration
To illustrate the concepts, consider a scenario where a cluster admin has provisioned a PersistentVolume:
- ReadWriteOnce
- ReadWriteOnce
Related reading
- what's meaning the container_cpu_cfs_throttled_seconds_total metrics
- What's the best way to share/mount one file into a pod?
- Whats the brief factual difference between Kubernetes, Helm and Rancher and others
- What's the difference between Apache's Mesos and Google's Kubernetes
- What's special about 169.254.169.254 IP address for AWS?
- What's the difference between AWS SSO and AWS Cognito?
- What's the difference between Docker Compose and Kubernetes?
- What's the difference between Docker Compose and Kubernetes?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.