Cases2 cases
1 to 2 of 2
IL-0044Prometheus OOMKilled in a loop while replaying its write-ahead log after a kube-prometheus-stack upgradeSaifeddine Rajhi2024- Symptoms
After an upgrade of the kube-prometheus-stack Helm chart, several pods stayed not ready. Among them was prometheus-prometheus-operator-prometheus-0, showing 3/4 Running and a recent termination.
- Trigger
During the kube-prometheus-stack Helm chart upgrade, Prometheus had to replay its write-ahead log on startup, and the replay needed more memory than its limit allowed.
- Root cause
- Component
- Contributing factor
- Detection
The team noticed pods not ready after the Helm chart upgrade and found the OOMKilled termination with kubectl describe pod.
- Remediation
- ran promtool tsdb analyze inside the Prometheus pod to find high-cardinality metrics such as haproxy_server_http_responses_total
- Action items
- Verify that the memory overhead during WAL replay stays within acceptable limits, for example 10 to 15%, and do not run Prometheus close to its memory limit
- Optimise storage, scraping and remote write configuration and upgrade to newer Prometheus releases
- Recover automatically from OOM crash loops, for example by deleting the WAL on OOM events
- Enforce scrape limits so Prometheus stops scraping targets when memory use passes a threshold
- Lessons
Size Prometheus for its restart, not only for steady state: WAL replay can need far more memory than normal running, and a Prometheus that already runs near its limit can be OOM-killed during the replay. Much of Prometheus memory use comes from cardinality, which promtool tsdb analyze can measure even when Prometheus itself is down.
- Symptoms
At 12:32 Prometheus on the Cloud Platform was not available after a planned change, and the Prometheus pod had restarted several times. The platform lost its monitoring and had missing metrics for the period.
- Trigger
A planned change restarted Prometheus at a time when the WAL count was high.
- Root cause
- Component
- Contributing factor
- Detection
The team saw that the Prometheus pod had restarted several times after the planned change.
- Remediation
- raised the Prometheus startupProbe threshold to 30 minutes
- Action items
- Perform planned Prometheus restarts when the WAL count is lower
- Set the default CPU and memory requests to meet maximum usage
- Create a test setup that recreates the live WAL count
- Explore the memory-snapshot-on-shutdown and auto-gomaxprocs feature flags
- Explore storing WAL files remotely in a different location
- Look into a blue-green Prometheus to test changes on a live-like setup before applying them to live
- Spike into Amazon Managed Prometheus
These 2 cases involve Prometheus and Container memory limit. kubegap audits a Kubernetes cluster for gaps like these, read-only, from Claude Code or Codex; its checks cite public reports like the ones in this library.
By root cause1
Capacity exhaustion2 cases
- Component
- Contributing factor
- Organisation