Sobes.tech
Junior — Middle

How does deleting a pod affect the stored PersistentVolume state in Kubernetes?

sobes.tech AI

Answer from AI

In Kubernetes, PersistentVolume (PV) is an abstraction for data storage that exists independently of the pod's lifecycle.

When a pod is deleted:

  • Data on the PersistentVolume is preserved, as PV is not directly bound to the pod.
  • If the PersistentVolumeClaim (PVC) associated with the PV is not deleted, the PV remains available for other pods.
  • The behavior depends on the reclaimPolicy of the PV:
    • Retain — data is preserved, the PV is not automatically deleted.
    • Delete — when the PVC is deleted, the PV with data may also be deleted (e.g., in cloud providers).
    • Recycle — outdated policy, performs cleanup.

Thus, deleting a pod does not lead to data loss on the PV unless the PVC with the delete policy is also removed.

How does deleting a pod affect the stored… - sobes.tech