PersistentVolume Reclaim Policies
Understand Retain, Delete, and Recycle reclaim policies for PersistentVolumes. Manage PV lifecycle after PVC deletion and recover bound volumes.
💡 Quick Answer:
Deleteremoves the backing storage when PVC is deleted (default for dynamic provisioning).Retainkeeps the volume data for manual recovery. Never useRecycle(deprecated).
The Problem
When a PVC is deleted, what happens to the data? Without understanding reclaim policies:
- Production data accidentally deleted with the PVC
- Orphaned cloud volumes accumulating costs
- Inability to recover data from released PVs
- Confusion about why a PV shows “Released” but can’t be rebound
The Solution
Check Current Policy
kubectl get pv -o custom-columns=NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phaseChange Policy on Existing PV
# Change from Delete to Retain (protect data)
kubectl patch pv pv-data-01 -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'StorageClass with Retain Policy
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: retain-ssd
provisioner: ebs.csi.aws.com
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer
parameters:
type: gp3
encrypted: "true"Recover a Released PV
# 1. PV is in "Released" state after PVC deletion
kubectl get pv pv-data-01
# STATUS: Released
# 2. Remove the claimRef to make it Available
kubectl patch pv pv-data-01 --type=json -p='[{"op":"remove","path":"/spec/claimRef"}]'
# 3. Create a new PVC that binds to this PVapiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: recovered-data
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: "" # Empty = manual binding
volumeName: pv-data-01
resources:
requests:
storage: 50GiStatic PV with Retain
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs-data
spec:
capacity:
storage: 100Gi
accessModes: ["ReadWriteMany"]
persistentVolumeReclaimPolicy: Retain
nfs:
server: 192.168.1.100
path: /exports/datastateDiagram-v2
[*] --> Available: PV Created
Available --> Bound: PVC Claims PV
Bound --> Released: PVC Deleted (Retain)
Bound --> [*]: PVC Deleted (Delete)
Released --> Available: Remove claimRef
Released --> [*]: Admin deletes PVCommon Issues
PV stuck in “Released” — can’t bind new PVC The claimRef still references the deleted PVC. Remove it:
kubectl patch pv <pv-name> --type=json -p='[{"op":"remove","path":"/spec/claimRef"}]'Dynamic PVs defaulting to Delete Most CSI drivers and cloud StorageClasses default to Delete. Create a Retain StorageClass for important data.
Orphaned cloud volumes after PVC deletion with Retain Retained PVs keep the cloud volume. Clean up manually:
# List Released PVs
kubectl get pv --field-selector=status.phase=Released
# Delete PV (doesn't delete cloud volume)
kubectl delete pv <pv-name>
# Delete cloud volume separately
aws ec2 delete-volume --volume-id vol-abc123Best Practices
- Use
Retainfor production databases and stateful workloads - Use
Deletefor ephemeral/reproducible data (caches, build artifacts) - Patch existing PVs to
Retainbefore dangerous operations - Create a
retain-*StorageClass variant for important workloads - Monitor Released PVs to prevent storage cost creep
- Use Velero or CSI snapshots as backup — don’t rely on Retain alone
- Document recovery procedures for your team
Key Takeaways
Delete: PV and backing storage removed when PVC is deletedRetain: PV moves to “Released” state, data preserved, manual recovery possibleRecycle: Deprecated — don’t use (was basicrm -rf)- StorageClass
reclaimPolicysets the default for dynamically provisioned PVs - Released PVs need
claimRefremoved before rebinding - Always use
Retain+ snapshots for production stateful data

Recommended
Kubernetes Recipes — The Complete Book100+ production-ready patterns with detailed explanations, best practices, and copy-paste YAML. Everything in one place.
Get the Book →Learn by Doing
CopyPasteLearn — Hands-on Cloud & DevOps CoursesMaster Kubernetes, Ansible, Terraform, and MLOps with interactive, copy-paste-run lessons. Start free.
Browse Courses →🎓 Deepen Your Skills — Hands-on Courses
Courses by CopyPasteLearn.com — Learn IT by Doing
