Konubinix' opinionated web of thoughts

Lifecycle of Persistent Volumes

Fleeting

lifecycle of persistent volumes in kubernetes.

Dynamic

  1. A PVC is created
  2. A Pod is created, that mounts a PVC
  3. mounting the PVC creates the associated PV, using the storageclass to know how
  4. when the pod is deleted, the PV remains, as it is bound to the PVC
  5. when the pvc is deleted, its deletion waits for all the pods that mount it before really deleting it.
  6. when the pvc is deleted, the associated pv is deleted

In other terms, a dynamic PVC is like a delayed PV.

Static

The PV is create prior to creating the PVC and is bound to it when the PVC is created.

When the PVC is deleted, the PV is deleted.

The reclaim policy

When the PV is deleted, the real data is either

  1. kept, when the reclaim policy is Retain
  2. deleted, when the reclaim policy is Delete

See https://kubernetes.io/docs/concepts/storage/persistent-volumes/

Currently, volumes can either be Retained, Recycled, or Deleted.

For volume plugins that support the Delete reclaim policy, deletion removes both the PersistentVolume object from Kubernetes, as well as the associated storage asset in the external infrastructure, such as an AWS EBS, GCE PD, Azure Disk, or Cinder volume