Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 65/ 160
04. Storage & Persistent Data

Reclaim Policies (Retain, Delete, Recycle)

Control what happens to underlying storage when a PVC is deleted.

IntermediateRetain · Delete · Reclaim3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Reclaim policy is the office move checklist: delete the room, retain it for the former tenant, or perform an old unsupported scrub routine. The simple Kubernetes rule is: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.

Think of it like…

Reclaim policy is the office move checklist: delete the room, retain it for the former tenant, or perform an old unsupported scrub routine.

Where you’ve seen it

Before approving a data-path change, the storage owner runs kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase. Expected evidence: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on. If the run instead shows this symptom, stop and restore the last known state: Deleting a PVC on Delete can permanently erase storage when snapshots or backups are absent, while Retain requires an explicit Released-volume cleanup and rebinding process.

Words you’ll hear

Retain
For this lesson, Retain is the controlling idea: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.
Delete
Delete is the checkpoint; run kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase and inspect the owner chain. Deleting a PVC on Delete can permanently erase storage when snapshots or backups are absent, while Retain requires an explicit Released-volume cleanup and rebinding process.
Reclaim
Reclaim is the outcome to preserve; the cost is explicit: Retain favors safety but causes orphaned cost; Delete removes cost and forgotten data but makes accidental claim deletion more dangerous.
Verification evidence
The evidence command is kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase. It connects the declaration to this behavior: Control what happens to underlying storage when a PVC is deleted.

Visual diagram

Loading interactive diagram

Theory & deep dive

How Retain reaches the intended state

Control what happens to underlying storage when a PVC is deleted. Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.

The concrete checkpoint is kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase; compare the Retain owner, Delete state, and Reclaim outcome instead of treating YAML acceptance as proof.

Verify Delete, not only object creation

Run kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase after the change and correlate the result with Events and the owning object. Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.

Key takeaway: Retain is implemented only when this invariant remains observable: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.

Delete: failure boundary and production cost

Deleting a PVC on Delete can permanently erase storage when snapshots or backups are absent, while Retain requires an explicit Released-volume cleanup and rebinding process. The prerequisite contract is concrete: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.

Retain favors safety but causes orphaned cost; Delete removes cost and forgotten data but makes accidental claim deletion more dangerous. A safe design limits blast radius, records the last good configuration, and uses kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase as a deterministic rollback checkpoint.

Recover from Delete drift

Capture the current state with kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: Deleting a PVC on Delete can permanently erase storage when snapshots or backups are absent, while Retain requires an explicit Released-volume cleanup and rebinding process.

Key takeaway: Accept the trade-off consciously: Retain favors safety but causes orphaned cost; Delete removes cost and forgotten data but makes accidental claim deletion more dangerous.

How it works, step by step

Step 1 of 4
Data owner

1. Declare the data contract

State capacity, topology, access, and ownership in the claim or class: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.

Retain contract → owned state
Key numbers at this step
Goal
Control what happens to underlying storage when a PVC is deleted.
Owner
Retain

When to use it & trade-offs

What it is

Control what happens to underlying storage when a PVC is deleted. Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.

Why it matters: Deleting a PVC on Delete can permanently erase storage when snapshots or backups are absent, while Retain requires an explicit Released-volume cleanup and rebinding process. The invariant at risk is specific: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on. The quickest fact check before changing the design is kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase.

When to reach for it

  • Use Retain to enforce this invariant: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.
  • Use Delete evidence from kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase in reviews and incident timelines. Control what happens to underlying storage when a PVC is deleted.
  • Choose the managed external data plane route only when this cost is justified by governance or scale: Retain favors safety but causes orphaned cost; Delete removes cost and forgotten data but makes accidental claim deletion more dangerous.

When to avoid or be careful

  • Avoid assuming Retain is complete after YAML submission; the required behavior is concrete: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.
  • Avoid treating the next symptom as random; check the owner and state with kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase first: Deleting a PVC on Delete can permanently erase storage when snapshots or backups are absent, while Retain requires an explicit Released-volume cleanup and rebinding process.
  • Avoid adopting a heavier platform wrapper before measuring its cost: Retain favors safety but causes orphaned cost; Delete removes cost and forgotten data but makes accidental claim deletion more dangerous.

Native, manual, and managed paths for Retain

Dynamically provisioned storage
Best for: Control what happens to underlying storage when a PVC is deleted. A concrete incident check is kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase.

Strengths: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.

Watch out: Retain favors safety but causes orphaned cost; Delete removes cost and forgotten data but makes accidental claim deletion more dangerous. Recovery must also recognize this signal: Deleting a PVC on Delete can permanently erase storage when snapshots or backups are absent, while Retain requires an explicit Released-volume cleanup and rebinding process.

Manual pre-provisioning
Best for: Quickly testing the Delete assumption with kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase; the expected invariant is: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.

Strengths: kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike Retain, it does not make this symptom self-documenting: Deleting a PVC on Delete can permanently erase storage when snapshots or backups are absent, while Retain requires an explicit Released-volume cleanup and rebinding process.

Managed external data plane
Best for: Teams that need Reclaim integrated with guardrails; the evidence path is kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.

Watch out: The added platform ownership buys value at this cost: Retain favors safety but causes orphaned cost; Delete removes cost and forgotten data but makes accidental claim deletion more dangerous.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.
  • Trace Retain to Reclaim through Delete; the invariant is: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.
  • Recognize the symptom: Deleting a PVC on Delete can permanently erase storage when snapshots or backups are absent, while Retain requires an explicit Released-volume cleanup and rebinding process.
  • Justify the cost: Retain favors safety but causes orphaned cost; Delete removes cost and forgotten data but makes accidental claim deletion more dangerous.
  • Verify with kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase instead of only inspecting YAML.

Benchmarks & rules of thumb

3 -
documented policy names, with Recycle legacy
1 -
Released PV generally needs manual handling before rebinding
0 -
automatic backup is provided by a reclaim policy

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the Retain owner contract: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on.
  • Ignoring this telltale condition leads to unrelated changes: Deleting a PVC on Delete can permanently erase storage when snapshots or backups are absent, while Retain requires an explicit Released-volume cleanup and rebinding process.
  • Repeating kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase without an owner for remediation wastes retry cost. Retain favors safety but causes orphaned cost; Delete removes cost and forgotten data but makes accidental claim deletion more dangerous.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on?
  • Which owner object, logs, and Events would you inspect for this symptom-Deleting a PVC on Delete can permanently erase storage when snapshots or backups are absent, while Retain requires an explicit Released-volume cleanup and rebinding process-?
  • At what threshold would this cost become unacceptable: Retain favors safety but causes orphaned cost; Delete removes cost and forgotten data but makes accidental claim deletion more dangerous?
Interview tip: Interview sequence: state the invariant, run kubectl patch pvc data -p '{"metadata":{"finalizers":[]}}' --dry-run=server; kubectl get pv -o custom-columns='NAME:.metadata.name,POLICY:.spec.persistentVolumeReclaimPolicy,STATUS:.status.phase, name the failure, then justify the cost. Invariant: Delete asks the provisioner to remove the backing volume after claim release, Retain leaves it for manual recovery, and Recycle is deprecated and should not be relied on. Failure: Deleting a PVC on Delete can permanently erase storage when snapshots or backups are absent, while Retain requires an explicit Released-volume cleanup and rebinding process. Cost: Retain favors safety but causes orphaned cost; Delete removes cost and forgotten data but makes accidental claim deletion more dangerous.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Reclaim Policies (Retain, Delete, Recycle) with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Access Modes (ReadWriteOnce, ReadWriteMany, ReadOnlyMany)
Next topic
StorageClasses & Dynamic Volume Provisioning