Skip to main content
RunBook Academy

KubernetesL · PersistentVolumes and ClaimsPersistentVolumes and Claims

Reclaim policies in depth — Retain, Delete, Recycle, and the backup strategy

Advanced⏱ ~16 minkubectl

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

Not yet marked complete on this device.

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

PolicyEffect on PVEffect on underlying storageStatus
RetainPV transitions to Released; preservedPreservedProduction default for stateful data
DeletePV is deletedDeleted by provisionerStandard for ephemeral data
RecyclePV is recycled (rm -rf)PreservedDeprecated in 1.30+

Retain

spec:
  persistentVolumeReclaimPolicy: Retain

When the PVC is deleted:

  1. The PV transitions to Released.
  2. The PV’s claimRef is cleared (the PV no longer references the PVC).
  3. The underlying storage is preserved.
  4. The PV remains in Released until 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:

  1. The PV transitions to Released briefly.
  2. The provisioner is called to delete the underlying storage (e.g., EBS volume).
  3. 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:

WorkloadReclaimBackup strategy
Production databaseRetainSnapshot schedule; tested restore
Stateless web appDeleteNo backup needed (data is reconstructed)
Batch processing outputDeleteBackup to object storage before delete
CI/CD build artifactsDeleteBackup to object storage
Log volumesDeleteLogs 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

  1. 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?

  2. Q2. The `Recycle` reclaim policy is still supported in Kubernetes 1.34.

  3. 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.

  4. 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.