Interview Prep/Monitoring & Observability/Prometheus storage, memory and cardinality

Prometheus logs `opening storage failed: ... unexpected EOF` / `corruption in segment` and won't start

AdvancedTroubleshootingPrometheus storage, memory and cardinality
Answer

Likely causes → WAL corruption after an unclean shutdown, node crash, full disk, or a storage layer that does not honour fsync (NFS).

Diagnose →

kubectl logs prometheus-k8s-0 -c prometheus --previous | grep -i 'wal\|corrupt'
ls -la /prometheus/wal/
df -h /prometheus

Fix → Recent versions attempt WAL repair automatically and truncate at the corrupt record. If it still fails, back up the directory, then move the bad segment(s) out of wal/ (you lose recent un-compacted samples, up to ~2h) and restart.

Prevent → Use local SSD or block volumes (EBS), never NFS; keep disk headroom; give pods a long terminationGracePeriodSeconds so the WAL closes cleanly.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus storage, memory and cardinality