KubernetesL · PersistentVolumes and ClaimsPersistentVolumes and Claims
Reclaim policies in depth — Retain, Delete, Recycle, and the backup strategy
What you'll learn
- Explain each reclaim policy in detail
- Identify what happens to the PV and underlying storage for each policy
- Align the reclaim policy with the backup strategy
- Apply the production pattern for reclaim policy choice
Prerequisites
Verified against Kubernetes 1.34.x · kubeadm 1.34.x · kubectl 1.34.x · etcd 3.6.x · CoreDNS 1.11.x · containerd 1.7.x / 2.x · 2026-08-16
The reclaim policy is the most consequential decision in the storage architecture. It determines what happens to the PV and the underlying storage when the PVC is deleted. This lesson walks each policy in depth and the alignment with the backup strategy.
The three policies
| Policy | Effect on PV | Effect on underlying storage | Status |
|---|---|---|---|
Retain | PV transitions to Released; preserved | Preserved | Production default for stateful data |
Delete | PV is deleted | Deleted by provisioner | Standard for ephemeral data |
Recycle | PV is recycled (rm -rf) | Preserved | Deprecated in 1.30+ |
Retain
spec:
persistentVolumeReclaimPolicy: Retain
When the PVC is deleted:
- The PV transitions to
Released. - The PV’s
claimRefis cleared (the PV no longer references the PVC). - The underlying storage is preserved.
- The PV remains in
Releaseduntil the operator acts.
The operator’s options for a Released PV:
- Recover: remove
claimRef, make the PV Available, bind to a new PVC. - Delete: delete the underlying storage, then delete the PV.
- Keep: leave the storage for archival or compliance.
# Substitute your own value before running:
PV=pvc-2f8ad51c-77b0-4e39-9c14-6ae0b3d95f82
# Recover a Released PV
kubectl edit pv "$PV"
# Delete spec.claimRef
# Save
# PV transitions from Released to Available
Delete
spec:
persistentVolumeReclaimPolicy: Delete
When the PVC is deleted:
- The PV transitions to
Releasedbriefly. - The provisioner is called to delete the underlying storage (e.g., EBS volume).
- The PV is deleted from the cluster.
The Delete reclaim policy is automatic; no operator
action is required. The trade-off: the data is gone; if
the PVC was deleted by accident, the data is gone too.
# Delete reclaim policy in action
kubectl delete pvc data
# PVC is deleted; provisioner is called to delete the EBS volume
# PV is removed from the cluster
Recycle (deprecated)
spec:
persistentVolumeReclaimPolicy: Recycle
Recycle performed a basic rm -rf of the volume’s
contents, then made the PV Available for re-binding. It
was deprecated because:
- It was unsafe (no snapshot safety net).
- It was inconsistent with backup-aware storage.
- It was incompatible with most CSI drivers (which do not support volume-content deletion).
Recycle was removed in Kubernetes 1.30+. The
replacement is Delete (with snapshots as the safety
net).
Aligning reclaim policy with backup strategy
The reclaim policy must align with the backup strategy:
| Workload | Reclaim | Backup strategy |
|---|---|---|
| Production database | Retain | Snapshot schedule; tested restore |
| Stateless web app | Delete | No backup needed (data is reconstructed) |
| Batch processing output | Delete | Backup to object storage before delete |
| CI/CD build artifacts | Delete | Backup to object storage |
| Log volumes | Delete | Logs are shipped to central aggregator |
The reclaim policy cascade
The reclaim policy is set on the PV, but it can be inherited from the StorageClass:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: db-ssd
provisioner: ebs.csi.aws.com
reclaimPolicy: Retain # <-- default for PVs from this StorageClass
parameters:
type: io2
When the provisioner creates a PV, it sets the PV’s reclaim policy to match the StorageClass. The user can override the reclaim policy on the PV (but the override is rare).
Quiz
Knowledge check · 4 questions
Q1. A database workload uses a StorageClass with `reclaimPolicy: Delete`. An operator accidentally runs `kubectl delete pvc data-postgres-0`. What is the recovery path?
Q2. The `Recycle` reclaim policy is still supported in Kubernetes 1.34.
Q3. Your team is migrating a production PostgreSQL workload from a `Delete` StorageClass to a `Retain` StorageClass. Walk through the migration steps.
PostgreSQL on StorageClass `db-default` (reclaimPolicy: Delete). The team wants to switch to `db-production` (reclaimPolicy: Retain) to prevent accidental data loss. The migration must be safe; data must not be lost.
Q4. Explain why Retain is the standard reclaim policy for production databases and what the trade-off is.
Passing score: 75%. Answers are checked in this browser.
Production discipline
- Retain for stateful data; Delete for ephemeral. The reclaim policy is the operator’s commitment to the backup strategy.
- Delete + stateful data = data loss waiting to happen. Always have a tested snapshot restore.
- Recycle is removed in 1.30+. Use Delete with snapshots.
- Reclaim policy cascades from StorageClass. The StorageClass’s reclaim policy is the default for PVs it provisions.
- Released PVs require operator action. Audit monthly; recover, delete, or keep per case.