PV Reclaim Policies
What you'll learn: How Kubernetes determines what happens to a PersistentVolume after its PersistentVolumeClaim is deleted.
When you delete a PVC, the PersistentVolume it was bound to doesn't just disappear—Kubernetes follows a reclaim policy that dictates the PV's fate. Think of it like deciding what happens to a storage unit after a tenant moves out: do you keep their belongings, throw them away, or prepare it for the next tenant?
The Three Reclaim Policies
Retain (the safe choice): The PV remains in the cluster with all its data intact, but becomes "Released" rather than "Available." No new PVC can claim it until an administrator manually cleans up the data and removes the claimRef field. This prevents accidental data loss and gives you time to backup or migrate data.
Delete (the automatic cleanup): The PV and its underlying storage resource (like an AWS EBS volume or Azure Disk) are automatically deleted when the PVC is removed. This is common with dynamically provisioned volumes where the storage was created just for that PVC. Be careful—your data is gone!
Recycle (deprecated): This policy was intended to scrub data (rm -rf /volume/*) and make the PV available again. It's no longer recommended and has been replaced by dynamic provisioning workflows.
When It Matters
The reclaim policy is set on the PV itself (or inherited from a StorageClass for dynamic provisioning). Choose Retain for production databases or critical data where you need recovery options. Use Delete for temporary or reproducible data where automatic cleanup saves administrative overhead.
Key Takeaway: PV reclaim policies control whether data is retained, deleted, or (historically) recycled after PVC deletion—choose Retain for safety or Delete for convenience, depending on your data's importance.