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

Someone ran `helm uninstall` on the production Postgres release; the PVC was deleted and the StorageClass has `reclaimPolicy: Delete`.

BeginnerTroubleshootingData loss and corruption
Answer

Likely causes → With reclaimPolicy: Delete, deleting the PVC deletes the PV and the underlying EBS volume. The data is gone from the cluster; only snapshots or backups can bring it back.

Diagnose →

kubectl get pv | grep postgres
aws ec2 describe-volumes --filters Name=tag:kubernetes.io/created-for/pvc/name,Values=data-pg-0
aws ec2 describe-snapshots --owner-ids self --filters Name=tag:app,Values=postgres --query 'Snapshots[].[SnapshotId,StartTime]'

Fix → Restore from the latest snapshot (create a volume, a static PV pointing at it, and a PVC that binds to it) or from a logical backup or WAL archive (pgBackRest, WAL-G, Velero). Then reinstall the release using that claim.

Prevent → Use reclaimPolicy: Retain for stateful data, take scheduled snapshots (Velero, AWS Backup, EBS snapshot policies), add helm.sh/resource-policy: keep to PVCs in charts, and restrict who can uninstall in production namespaces.

All Real-World Interview questions Roadmap: Interview readiness

More on Data loss and corruption