What is a reclaim policy in Kubernetes Persistent Volumes?
A reclaim policy tells Kubernetes what to do with a Persistent Volume after its claim is deleted. It can either keep the volume (Retain) or remove it (Delete).
Click to reveal answer
beginner
What does the 'Retain' reclaim policy do?
The 'Retain' policy keeps the Persistent Volume and its data even after the Persistent Volume Claim is deleted. The volume must be manually cleaned or reused.
Click to reveal answer
beginner
What happens when the reclaim policy is set to 'Delete'?
When set to 'Delete', Kubernetes automatically deletes the Persistent Volume and its underlying storage when the Persistent Volume Claim is deleted.
Click to reveal answer
intermediate
Which reclaim policy is safer for preserving data after a claim is deleted?
The 'Retain' policy is safer because it keeps the data intact and requires manual cleanup, preventing accidental data loss.
Click to reveal answer
intermediate
How do you specify a reclaim policy in a Persistent Volume YAML?
You add the field 'persistentVolumeReclaimPolicy' with value 'Retain' or 'Delete' under the Persistent Volume spec.
Click to reveal answer
What does the 'Delete' reclaim policy do in Kubernetes Persistent Volumes?
AKeeps the volume and data after claim deletion
BLocks the volume to prevent deletion
CArchives the volume for backup
DDeletes the volume and data after claim deletion
✗ Incorrect
The 'Delete' policy removes the Persistent Volume and its data automatically when the claim is deleted.
Which reclaim policy requires manual cleanup of the volume?
ARetain
BRecycle
CDelete
DArchive
✗ Incorrect
The 'Retain' policy keeps the volume and data, so manual cleanup is needed.
Where do you set the reclaim policy in a Persistent Volume configuration?
Aspec.accessModes
Bmetadata.labels
Cspec.persistentVolumeReclaimPolicy
Dspec.storageClassName
✗ Incorrect
The reclaim policy is set under spec.persistentVolumeReclaimPolicy in the Persistent Volume YAML.
If you want to keep data safe after a claim is deleted, which reclaim policy should you choose?
ARetain
BDelete
CRecycle
DNone
✗ Incorrect
Retain keeps the volume and data intact, preventing accidental deletion.
What happens to the underlying storage when reclaim policy is 'Delete' and claim is deleted?
AStorage is preserved for reuse
BStorage is deleted automatically
CStorage is backed up
DStorage is locked
✗ Incorrect
The underlying storage is deleted automatically with the volume.
Explain the difference between 'Retain' and 'Delete' reclaim policies in Kubernetes Persistent Volumes.
Think about what happens to the volume after the claim is deleted.
You got /4 concepts.
Describe how to set a reclaim policy in a Persistent Volume YAML file.
Look inside the spec section of the YAML.
You got /3 concepts.
Practice
(1/5)
1. What does the Retain reclaim policy do in Kubernetes Persistent Volumes?
easy
A. Keeps the volume and data after the PersistentVolumeClaim is deleted for manual cleanup.
B. Automatically deletes the volume and data when the PersistentVolumeClaim is deleted.
C. Prevents any deletion of the PersistentVolumeClaim.
D. Creates a backup of the volume before deletion.
Solution
Step 1: Understand reclaim policies
Reclaim policies define what happens to storage after the claim is deleted.
Step 2: Identify Retain behavior
The Retain policy keeps the volume and data intact for manual intervention.
Final Answer:
Keeps the volume and data after the PersistentVolumeClaim is deleted for manual cleanup. -> Option A
Quick Check:
Retain = Keep data safe [OK]
Hint: Retain means keep data after claim deletion [OK]
Common Mistakes:
Confusing Retain with automatic deletion
Thinking Retain backs up data automatically
Assuming Retain prevents claim deletion
2. Which of the following is the correct YAML snippet to set a PersistentVolume reclaim policy to Delete?
easy
A. persistentVolumeReclaimPolicy: Retain
B. persistentVolumeReclaimPolicy: Delete
C. persistent_volume_reclaim_policy: Delete
D. persistentVolumeReclaimPolicy: delete
Solution
Step 1: Check correct YAML key and value
The key is persistentVolumeReclaimPolicy, and value is case-sensitive.
Step 2: Identify correct value for Delete
The value must be exactly Delete with capital D.
Final Answer:
persistentVolumeReclaimPolicy: Delete -> Option B
Quick Check:
Correct key and capitalized value = A [OK]
Hint: Use exact key 'persistentVolumeReclaimPolicy' and capitalized 'Delete' [OK]
What happens to the volume when the PersistentVolumeClaim using this PV is deleted?
medium
A. The volume and data are deleted automatically.
B. The volume is unbound but data is deleted.
C. The volume is retained and data remains for manual cleanup.
D. The volume is backed up before deletion.
Solution
Step 1: Identify reclaim policy in YAML
The reclaim policy is set as Retain in persistentVolumeReclaimPolicy.
Step 2: Understand Retain effect on deletion
Retain means the volume and data stay after claim deletion for manual handling.
Final Answer:
The volume is retained and data remains for manual cleanup. -> Option C
Quick Check:
Retain policy = keep volume and data [OK]
Hint: Retain policy keeps volume after claim deletion [OK]
Common Mistakes:
Assuming data deletes automatically with Retain
Confusing persistentVolumeReclaimPolicy with reclaimPolicy key
Thinking volume is backed up automatically
4. You set a PersistentVolume reclaim policy to Delete but after deleting the PersistentVolumeClaim, the volume still exists. What is the most likely cause?
medium
A. The reclaim policy was misspelled in the YAML and ignored.
B. The volume was manually retained by an admin.
C. The PersistentVolumeClaim was not actually deleted.
D. The storage class does not support automatic deletion.
Solution
Step 1: Understand Delete reclaim policy
Delete policy should remove the volume automatically after claim deletion.
Step 2: Check storage class support
If the storage class does not support dynamic deletion, volume remains despite policy.
Final Answer:
The storage class does not support automatic deletion. -> Option D
Quick Check:
Storage class support needed for Delete policy [OK]
Hint: Delete needs storage class support to remove volume [OK]
5. You want to ensure that when a PersistentVolumeClaim is deleted, the underlying storage is kept intact for backup purposes, but you also want to automate cleanup later. Which reclaim policy should you use and what additional step is needed?
hard
A. Use Retain policy and configure a cleanup job to delete volumes later.
B. Use Delete policy and rely on automatic cleanup only.
C. Use Retain policy and manually delete the volume after backup.
D. Use Delete policy and create snapshots before deletion.
Solution
Step 1: Choose policy to keep data after claim deletion
Retain policy keeps the volume and data safe after claim deletion.
Step 2: Automate cleanup after backup
Since Retain does not delete automatically, a cleanup job is needed to remove volumes later.
Final Answer:
Use Retain policy and configure a cleanup job to delete volumes later. -> Option A