🎓 LEVEL 39 DEBRIEF: PV Reclaim Policies¶
Congratulations! You've mastered reclaim policies - essential for preventing accidental data loss!
📊 What You Fixed¶
The Problem:
Result: When PVC deleted → PV deleted → All data permanently lost!The Solution:
Result: When PVC deleted → PV marked "Released" → Data preserved🔍 Understanding Reclaim Policies¶
The Three Policies¶
1. Delete (Automatic Cleanup)
When PVC deleted: - PV automatically deleted - Storage released back to pool - All data permanently lostUse for: Development, test environments, ephemeral data
2. Retain (Manual Cleanup)
When PVC deleted: - PV status → "Released" - Data remains on disk - Manual cleanup required - Data preservedUse for: Production, databases, critical data
3. Recycle (Deprecated)
- Runsrm -rf on volume
- No longer recommended
- Use Delete or Retain instead
💥 Common Mistakes¶
Mistake 1: Delete for Production¶
Fix:
Mistake 2: Not Testing Deletion¶
# Never tested what happens when PVC deleted
kubectl delete pvc my-data
# Oops! All data gone with Delete policy
Mistake 3: Forgetting Manual Cleanup¶
🛡️ Best Practices¶
-
Use Retain for production:
-
Document policy in annotations:
-
Set in StorageClass:
-
Process for Retain cleanup:
-
Monitor Released PVs:
🎯 Key Takeaways¶
- Retain = Safe - Data preserved when PVC deleted
- Delete = Automatic - Data lost when PVC deleted
- Use Retain for production - Prevent accidental data loss
- Manual cleanup required - With Retain policy
- Set in StorageClass - For consistency
Well done! You understand reclaim policies! 🎉