Have a question about pv and pvc. From the lecture the admin can create a large . . .

Chandu:
Have a question about pv and pvc. From the lecture the admin can create a large pool of storage and users carve out pieces from it. And in a later lecture it is mentioned that pv and pvc has 1:1 relationship. My understanding is no of pvs >= pvcs. That means there could be more pvs than the pvcs. Since there could be volumes no one has claimed yet. But, in the same video it is mentioned that if a volume is claimed by a pvc rest of the storage can’t be used by any other claim. These statements make me confusing. The whole point of PVs and PVCs are not to create volumes for each pod deployment. It should be created once and be used by the pods centrally. Please correct me if I am wrong. That being said if I create a volume of 50Gi and claim only 1Gi that means can I still claim the rest of the 49Gi or would the volume gets wasted? Please help me understand pvs and pvcs better.
image.png
image.png

Chandu:
Or we create 100Gi of storage like EBS and point it to the pv to carve out 1Gi, and another pv of 20 Gi like that and claim those pvs?

Chandu:
@unnivkn @Alistair Mackay @Trung Tran

Leo Pastor:
@Chandu
“… if I create a volume of 50Gi and claim only 1Gi that means can I still claim the rest of the 49Gi …?”
Short answer is: NO!
If a PV of 50Gi is bounded to a PVC that claims only 1Gi - it is probably because there was no better option for the PVC to bind to (several other considerations should be taken, but that is the central idea really)
Could you please tell which lecture you referred to and or source of screenshots (for better context)?

Chandu:
pv and pvc in CKAD

Alistair Mackay:
Yes

Alistair Mackay:
While it is true that there is a 1:1 relationship between a PV and a PVC, in a real production scenario, what usually happens is that the cluster administrator sets up an auto-provisioner with a storage class associated. The auto-provisioner will create PVs on demand when a PVC requests via the storage class.

Examples are
• NFS provisioner - creates PV from an NFS server (usually cloud-based like Amazon EFS)
• EBS provisioner (AWS) - create a virtual hard disk and attaches it to the node where the PVC is requesting from
• Provisioners associated with popular SAN solutions for use in on-premise clusters.
The access modes available depend on the capabilities of the storage, i.e. for a virtual hard disk, the Many types might only be supported if the disk supports attachment to multiple nodes simultaneously.

HostPath PVs as used in lectures and exam are not recommended for production use.