You deleted a StatefulSet and its PVCs remain. Is this expected, and how do you control it?
IntermediateScenarioConfiguration, Secrets and storage
Answer
Situation read → Storage costs are growing from orphaned volumes.
What I'd do →
- Yes, StatefulSet PVCs are retained by default
- Use
persistentVolumeClaimRetentionPolicywithwhenDeleted: DeleteandwhenScaled: Retainwhere appropriate - Check PV
reclaimPolicy(Delete or Retain) on the StorageClass - List orphaned volumes with
kubectl get pvc -Aand cloud tags - Clean up deliberately
Why → The default favours data safety over cost.
Interview tip → Say you tag volumes by cluster to find orphans.
More on Configuration, Secrets and storage
How do you inject configuration into pods and what are the options?BeginnerA ConfigMap was updated but the pod still shows old values. Why?IntermediateHow do you store a database password safely in Kubernetes?BeginnerHow do you manage secrets in GitOps without committing them in plain text?IntermediateA pod fails with `CreateContainerConfigError` and a missing key. What happened?BeginnerWhat is the difference between emptyDir, hostPath, PV/PVC and when do you use each?Beginner