Kubernetes How do I delete PV in the correct manner
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Deleting a PersistentVolume in Kubernetes is not just a kubectl delete pv operation. The correct process depends on whether the volume is still claimed, what the reclaim policy is, and whether you want to keep or destroy the underlying storage.
Start With the PVC, Not the PV
A PersistentVolume, or PV, is the cluster-side storage object. A PersistentVolumeClaim, or PVC, is the workload-side request for that storage. In a normal lifecycle, the PVC is the object you delete first.
If a PV is still bound to a claim, deleting the PV directly often leaves the claim stuck or triggers confusing controller behavior. Start by checking the current state:
If the PV shows STATUS=Bound, find the claim name and namespace from kubectl describe pv. Then remove the workload that is actively using the claim, or update it so it no longer mounts that storage. After that, delete the PVC:
At this point the PV usually moves from Bound to Released. What happens next depends on the reclaim policy.
Understand the Reclaim Policy
The reclaim policy controls what Kubernetes should do after the claim is deleted.
Delete means the backing storage should be removed automatically if the provisioner supports that behavior. This is common with dynamically provisioned cloud disks.
Retain means the PV object stays around and the underlying storage is kept. This is safer when the data matters, but it also means cleanup is partly manual.
You can inspect the policy like this:
If the policy is Retain, deleting the PVC does not wipe the disk. You may need to inspect the cloud volume, NFS export, or local path yourself before removing the PV object.
Safe Deletion Sequence
A practical deletion flow looks like this:
- Stop pods that are still writing to the PVC.
- Delete the PVC.
- Wait for the PV to enter
Releasedor disappear automatically. - If the PV remains, inspect its reclaim policy and any finalizers.
- Delete the PV only after you know whether the backing storage should survive.
Example session:
That final delete is appropriate when the volume is no longer needed or when the underlying disk has already been handled.
When Finalizers Block Removal
Sometimes a PV or PVC stays in Terminating. This usually means a controller finalizer is still present because Kubernetes is waiting for a detach, cleanup, or provisioner action.
Inspect the object:
If the storage backend is healthy, the finalizer often clears on its own. If it does not, investigate the CSI driver, cloud provider logs, or node attach state before forcing anything. Removing finalizers manually is possible, but it should be a last resort because it can orphan real storage.
Static Versus Dynamic Volumes
Statically created PVs often point to infrastructure that Kubernetes does not fully manage. For example, an NFS share or a pre-created cloud disk may remain even after the PV object is gone. In that case, deleting only the Kubernetes object does not actually reclaim capacity.
Dynamically provisioned PVs are usually safer to delete because the storage class and CSI driver know how to clean up the backing resource. Even then, verify the reclaim policy instead of assuming deletion is automatic.
Here is a minimal PV example showing the key field:
With Retain, the path or disk survives until you clean it up deliberately.
Common Pitfalls
Deleting the PV before the PVC is the most common mistake. Kubernetes is designed around claim-driven storage, so removing the volume first often creates stuck resources.
Another mistake is assuming kubectl delete pv always deletes the real disk. That only happens when the reclaim policy and provisioner support it.
A third issue is forcing finalizer removal without checking the storage backend. That may hide the symptom while leaving an attached or billable resource behind.
Summary
- Delete the PVC before deleting the PV in normal workflows.
- Check whether the PV is
Bound,Released, or already deleting. - Inspect
persistentVolumeReclaimPolicybefore deciding what cleanup should happen. - '
Deleteusually removes storage automatically;Retainusually requires manual cleanup.' - Treat stuck finalizers as a storage-controller problem first, not a patch-it-away problem.

