Prometheus restarts every few minutes with OOMKilled, and the TSDB head series count jumped from 2M to 30M after a deploy.
AdvancedTroubleshootingDisk, memory and CPU
Answer
Likely causes → A cardinality explosion: a new metric label with unbounded values such as user_id, request_id, full URL path, or pod-specific IDs. Every unique combination is a new series, and Prometheus keeps the head block in memory.
Diagnose →
curl -s localhost:9090/api/v1/status/tsdb | jq '.data.seriesCountByMetricName[:10], .data.labelValueCountByLabelName[:10]'
Or in PromQL (once it stays up): topk(10, count by (__name__)({__name__=~".+"})).
Fix → Drop the bad label or metric at scrape time while the app is fixed:
metric_relabel_configs:
- regex: user_id
action: labeldrop
- source_labels: [__name__]
regex: debug_cache_entry_info
action: drop
Restart with more memory if needed to replay the WAL.
Prevent → Set sample_limit per scrape job, review new metrics in code review (no IDs as labels), and alert on prometheus_tsdb_head_series growth.
More on Disk, memory and CPU
The app fails to write with "No space left on device", but `df -h` shows the volume is only 40% used.Beginner`df -h` says `/` is 100% full, but `du -sh /*` only adds up to 30% of the disk.BeginnerA server shows load average 40 on 8 cores, but `top` shows CPU 60% idle and the app is crawling.BeginnerPods are being evicted with "The node was low on resource: ephemeral-storage. Container app was using 18Gi, which exceeds its request of 0."IntermediateCI build agents running Docker fail with "no space left on device" while pulling images; `/var/lib/docker` is 95% full.IntermediatePostgres on a VM died overnight; `dmesg` shows "Out of memory: Killed process 2314 (postgres) total-vm:..., anon-rss:...".Intermediate