Interview Prep/Real-World Interview/Data loss and corruption

Someone ran `kubectl delete namespace payments` in production by mistake.

IntermediateTroubleshootingData loss and corruption
Answer

Likely causes → A broad RBAC role and the wrong kube context. Deleting the namespace deletes everything in it: Deployments, Services, Secrets, ConfigMaps and PVCs (and their volumes if reclaimPolicy: Delete). Cloud load balancers created by Services are deleted too, and they'll come back with new DNS names.

Diagnose → List what was in the namespace from Git (GitOps repo), Velero backups, or the audit log. Check whether the PVs were retained (kubectl get pv | grep payments).

Fix → Recreate from the source of truth: re-sync the Argo CD/Flux app, or velero restore create --from-backup daily-2026-11-09 --include-namespaces payments. Re-bind retained PVs, recreate Secrets from the secret manager, and update DNS if load balancer hostnames changed.

Prevent → No delete rights on namespaces for humans in prod, separate kube contexts with visible prompts (kube-ps1), GitOps as the only deploy path, scheduled Velero backups, and an admission policy that blocks deleting labelled critical namespaces.

All Real-World Interview questions Roadmap: Interview readiness

More on Data loss and corruption