Someone deleted a Kubernetes namespace in production, including PVCs. How do you recover, and how should you prepare for this?
IntermediateScenarioData and databases
Answer
Situation read → GitOps can recreate the objects, but the data in the volumes depends on the reclaim policy and on backups.
What I'd do →
- Check whether the PVs survived: with
reclaimPolicy: Retainthe PV and EBS volume still exist inReleasedstate.
kubectl get pv | grep Released
- If retained, clear the old
claimRefon the PV and rebind it to a recreated PVC with the same name. - If not retained, restore from Velero (which snapshots volumes):
velero restore create --from-backup daily-20261109 --include-namespaces payments
- Let Argo CD resync the rest (Deployments, Services, ConfigMaps).
- Prepare:
Retainfor stateful StorageClasses, scheduled Velero backups with restore tests, RBAC so few people can delete namespaces, and an admission policy or Argo CD setting that blocks namespace deletion for critical ones.
Why → Objects are cheap to recreate from Git; data is not. Protect data separately.
Interview tip → Mention reclaimPolicy: Retain; the default Delete is how data disappears with the namespace.
More on Data and databases
A release needs to rename a column that the running app reads and writes. How do you do it with zero downtime?IntermediateHow do you prove your database backups actually work?IntermediateDesign backups for an RDS PostgreSQL database with RPO of 5 minutes and RTO of 1 hour, including a region failure.AdvancedYour migrations run in an init container and two pods ran them at the same time during a deploy, leaving the schema half-applied. How do you fix the approach?IntermediateUpgrade RDS PostgreSQL from 13 to 17 with minimal downtime. How?AdvancedYou need to add an index and a column to a 500-million-row table that's written to constantly. How do you avoid locking it?Advanced