Persistent Volumes (PV) & Persistent Volume Claims (PVC)

Persistent Volume

Persistent Volume is a cluster wide storage available for all the pods and the users

There are many access modes for PVs such as

  • ReadOnlyMany
  • ReadWriteMany
  • ReadWriteOnce

in the PV manifest file we can choose the storage provider and have the PV provisioned for that cluster

Persistent Volume Claim

once the Persistent Volumes (PV) & Persistent Volume Claims (PVC) > Persistent Volume has been provisioned, the Pod can claim the volume for use, PV and PVC have a one to one relationship, if the PVC requests for lower storage but bind to a higher capacity PV the remaining space cannot be used by other PVC

using persistentVolumeReclaimPolicy we can define what happens when a PV is reclaimed by the Kubernetes cluster

  • retain - the PV will be on the cluster until the admin manages it
  • delete - the PV is deleted as soon as the PVC is delete
  • recycle - the PV is scrubbed or cleared before any other PVC can claim it (like formatting)