I'm curious about the need for both Persistent Volume Claims (PVCs) and Persistent Volumes (PVs) in Kubernetes. I understand why there's a separation, but why are PVCs their own resource instead of being declared directly within a Pod? If they were part of the Pod's configuration, we could still keep the PV alive and reuse it when the Pod dies or restarts on another node. What am I missing here?
5 Answers
The separation provides an abstraction layer that allows multiple workloads in a namespace to access the same storage resource. It enables you to swap out storage without needing admin rights or rewriting your Deployment manifests, which is pretty handy.
That makes sense! But if those concerns were addressed under the PVC concept, I think it could be beneficial for everyone.
Historically, we used to pre-provision volumes, and PVs represented these resources. PVCs were how you requested access. Nowadays, with most people using dynamic volume allocation, the separate models aren't as obviously necessary anymore.
Some of us remember the days before dynamic allocation where you had to manually request volumes from the storage team.
Wow, that really makes me feel old! I started with Kubernetes back at OpenShift 3.6, and it was a hassle having to create PVs blindly!
You can actually retain your PVs when a Pod dies. Just set the `reclaimPolicy` in the StorageClass to `Retain` or adjust it directly in the PV settings if you're using static volumes.
Think of it this way: the PV is the actual data device, while the PVC is how you map it to a node. Plus, some volumes can be accessed by multiple Pods simultaneously, making the separation essential for certain use cases.
That's a solid analogy! It’s like the role and role binding in RBAC. You can delete the PVC without losing the PV.
This explanation is fantastic! You should definitely consider contributing to Kubernetes documentation!
One way to visualize it is this: the PV is like your shirt and the PVC is like your dry-cleaning claim ticket. They both relate to the same shirt, but serve different purposes.

That's a great way to frame it!