What happens to volume data when a Pod is deleted?
volume lifecycle awareness.
emptyDir is tied to the Pod and erased when the Pod is deleted; a PVC-backed PV with Retain keeps the data after the PVC is released for manual recovery.
WHAT THIS TESTS Whether you can distinguish ephemeral, Pod-scoped storage from durable, cluster-scoped storage, and whether you know what reclaim policies actually do.
A GOOD ANSWER COVERS An emptyDir volume is created when a Pod is scheduled to a node and exists only for that Pod's lifetime. It survives container restarts within the Pod, but when the Pod is deleted or rescheduled to another node, the emptyDir and all its contents are erased. It is meant for scratch space, caches, or sharing files between containers in the same Pod. A PersistentVolumeClaim backed by a PersistentVolume is different: the data lives on storage whose lifecycle is independent of the Pod. With the Retain reclaim policy, deleting the PVC does not delete the data. The bound PV transitions to the Released state, the external storage asset and its data remain intact, and an administrator can manually recover or re-provision it. Retain explicitly does not auto-rebind or auto-delete, unlike the Delete policy, which removes the backing storage.
COMMON WRONG ANSWERS Thinking emptyDir persists across Pod deletion or node moves. Believing Retain makes the volume automatically reusable by a new PVC. Confusing Retain with Recycle, which is deprecated. Assuming all PVCs delete their data when released.
LIKELY FOLLOW-UPS How do the Delete and the deprecated Recycle policies differ from Retain? When would you choose emptyDir with memory medium? How do you reclaim a Released PV for reuse?
ONE CONCRETE EXAMPLE A Pod uses emptyDir for a build cache; deleting the Pod wipes the cache. A database Pod uses a PVC bound to a Retain PV; deleting the PVC leaves the EBS volume and its data intact in Released state so an operator can attach it to a new claim after manual cleanup.
Read the original → kubernetes.io
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.