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

Prometheus pod restarts with `OOMKilled` every few hours

IntermediateTroubleshootingPrometheus storage, memory and cardinality
Answer

Likely causes → Too many active series in the head block (cardinality growth), heavy queries loading long ranges, or memory limits sized for last year's load.

Diagnose →

kubectl describe pod prometheus-k8s-0 -n monitoring | grep -A3 'Last State'
prometheus_tsdb_head_series
topk(10, count by (__name__)({__name__=~".+"}))

Use Status → TSDB Status for top series by metric and label.

Fix → Drop the offending series with metric_relabel_configs, add query limits (--query.max-samples), and size memory at roughly a few KB per active series plus query headroom.

Prevent → Alert on prometheus_tsdb_head_series growth and per-job scrape_series_added.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus storage, memory and cardinality