<p>Periodically I see the container
<strong>Status: terminated - OOMKilled</strong> (exit code: 137)</p>
<p>But it's scheduled to the node with plenty of memory</p>
<pre class="lang-sh prettyprint-override"><code>$ k get statefulset -n metrics 
NAME                      READY   AGE
prometheus                0/1     232d


$ k get po -n metrics
prometheus-0  1/2     CrashLoopBackOff   147        12h

$ k get events  -n metrics
LAST SEEN   TYPE      REASON    OBJECT             MESSAGE
10m         Normal    Pulled    pod/prometheus-0   Container image &quot;prom/prometheus:v2.11.1&quot; already present on machine
51s         Warning   BackOff   pod/prometheus-0   Back-off restarting failed container


k logs -f prometheus-0 -n metrics --all-containers=true

level=warn ts=2020-08-22T20:48:02.302Z caller=main.go:282 deprecation_notice=&quot;'storage.tsdb.retention' flag is deprecated use 'storage.tsdb.retention.time' instead.&quot;
level=info ts=2020-08-22T20:48:02.302Z caller=main.go:329 msg=&quot;Starting Prometheus&quot; version=&quot;(version=2.11.1, branch=HEAD, revision=e5b22494857deca4b806f74f6e3a6ee30c251763)&quot;
level=info ts=2020-08-22T20:48:02.302Z caller=main.go:330 build_context=&quot;(go=go1.12.7, user=root@d94406f2bb6f, date=20190710-13:51:17)&quot;
level=info ts=2020-08-22T20:48:02.302Z caller=main.go:331 host_details=&quot;(Linux 4.14.186-146.268.amzn2.x86_64 #1 SMP Tue Jul 14 18:16:52 UTC 2020 x86_64 prometheus-0 (none))&quot;
level=info ts=2020-08-22T20:48:02.302Z caller=main.go:332 fd_limits=&quot;(soft=1048576, hard=1048576)&quot;
level=info ts=2020-08-22T20:48:02.303Z caller=main.go:333 vm_limits=&quot;(soft=unlimited, hard=unlimited)&quot;
level=info ts=2020-08-22T20:48:02.307Z caller=main.go:652 msg=&quot;Starting TSDB ...&quot;
level=info ts=2020-08-22T20:48:02.307Z caller=web.go:448 component=web msg=&quot;Start listening for connections&quot; address=0.0.0.0:9090
level=info ts=2020-08-22T20:48:02.311Z caller=repair.go:59 component=tsdb msg=&quot;found healthy block&quot; mint=1597968000000 maxt=1597975200000 ulid=01EG7FAW5PE9ARVHJNKW1SJXRK
level=info ts=2020-08-22T20:48:02.312Z caller=repair.go:59 component=tsdb msg=&quot;found healthy block&quot; mint=1597975200000 maxt=1597982400000 ulid=01EG7P6KDPXPFVPSMBXBDF48FQ
level=info ts=2020-08-22T20:48:02.313Z caller=repair.go:59 component=tsdb msg=&quot;found healthy block&quot; mint=1597982400000 maxt=1597989600000 ulid=01EG7X2ANPN30M8ET2S8EPGKEA
level=info ts=2020-08-22T20:48:02.314Z caller=repair.go:59 component=tsdb msg=&quot;found healthy block&quot; mint=1597989600000 maxt=1597996800000 ulid=01EG83Y1XPXRWRRR2VQRNFB37F
level=info ts=2020-08-22T20:48:02.314Z caller=repair.go:59 component=tsdb msg=&quot;found healthy block&quot; mint=1597996800000 maxt=1598004000000 ulid=01EG8ASS5P9J1TBZW2P4B2GV7P
level=info ts=2020-08-22T20:48:02.315Z caller=repair.go:59 component=tsdb msg=&quot;found healthy block&quot; mint=1598004000000 maxt=1598011200000 ulid=01EG8HNGDXMYRH0CGWNHKECCPR
level=info ts=2020-08-22T20:48:02.316Z caller=repair.go:59 component=tsdb msg=&quot;found healthy block&quot; mint=1598011200000 maxt=1598018400000 ulid=01EG8RH7NPHSC5PAGXCMN8K9HE
level=info ts=2020-08-22T20:48:02.317Z caller=repair.go:59 component=tsdb msg=&quot;found healthy block&quot; mint=1598018400000 maxt=1598025600000 ulid=01EG8ZCYXNABK8FD3ZGFSQ9NGQ
level=info ts=2020-08-22T20:48:02.317Z caller=repair.go:59 component=tsdb msg=&quot;found healthy block&quot; mint=1598025600000 maxt=1598032800000 ulid=01EG968P5T7SJTVDCZGN6D5YW2
level=info ts=2020-08-22T20:48:02.317Z caller=repair.go:59 component=tsdb msg=&quot;found healthy block&quot; mint=1598032800000 maxt=1598040000000 ulid=01EG9D4DDPR9SE62C0XNE0Z64C
level=info ts=2020-08-22T20:48:02.318Z caller=repair.go:59 component=tsdb msg=&quot;found healthy block&quot; mint=1598040000000 maxt=1598047200000 ulid=01EG9M04NYMAFACVCMDD2RF11W
level=info ts=2020-08-22T20:48:02.319Z caller=repair.go:59 component=tsdb msg=&quot;found healthy block&quot; mint=1598047200000 maxt=1598054400000 ulid=01EG9TVVXNJ7VCDXQNNK2BTZAE
level=info ts=2020-08-22T20:48:02.320Z caller=repair.go:59 component=tsdb msg=&quot;found healthy block&quot; mint=1598054400000 maxt=1598061600000 ulid=01EGA1QK5PHHZ6P6TNPHDWSD81

k describe statefulset prometheus -n metrics
Name:               prometheus
Namespace:          metrics
CreationTimestamp:  Fri, 03 Jan 2020 04:33:58 -0800
Selector:           app=prometheus
Labels:             &lt;none&gt;
Annotations:        &lt;none&gt;
Replicas:           1 desired | 1 total
Update Strategy:    RollingUpdate
  Partition:        824644121032
Pods Status:        1 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template:
  Labels:           app=prometheus
  Annotations:      checksum/config: 6982e2d83da89ab6fa57e1c2c8a217bb5c1f5abe13052a171cd8d5e238a40646
  Service Account:  prometheus
  Containers:
   prometheus-configmap-reloader:
    Image:      jimmidyson/configmap-reload:v0.1
    Port:       &lt;none&gt;
    Host Port:  &lt;none&gt;
    Args:
      --volume-dir=/etc/prometheus
      --webhook-url=http://localhost:9090/-/reload
    Environment:  &lt;none&gt;
    Mounts:
      /etc/prometheus from prometheus (ro)
   prometheus:
    Image:      prom/prometheus:v2.11.1
    Port:       9090/TCP
    Host Port:  0/TCP
    Args:
      --config.file=/etc/prometheus/prometheus.yml
      --web.enable-lifecycle
      --web.enable-admin-api
      --storage.tsdb.path=/prometheus/data
      --storage.tsdb.retention=1d
    Limits:
      memory:     1Gi
    Liveness:     http-get http://:9090/-/healthy delay=180s timeout=1s period=120s #success=1 #failure=3
    Environment:  &lt;none&gt;
    Mounts:
      /etc/prometheus from prometheus (rw)
      /etc/prometheus-alert-rules from prometheus-alert-rules (rw)
      /prometheus/data from prometheus-data-storage (rw)
  Volumes:
   prometheus:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      prometheus
    Optional:  false
   prometheus-alert-rules:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      prometheus-alert-rules
    Optional:  false
Volume Claims:
  Name:          prometheus-data-storage
  StorageClass:  prometheus
  Labels:        &lt;none&gt;
  Annotations:   &lt;none&gt;
  Capacity:      20Gi
  Access Modes:  [ReadWriteOnce]
Events:          &lt;none&gt;
</code></pre>
<p>What could be the reason?</p>

<blockquote>
<p>Periodically I see the container Status: terminated - OOMKilled (exit code: 137)</p>
</blockquote>
<blockquote>
<p>But it's scheduled to the node with plenty of memory</p>
</blockquote>
<p>As you may have already seen it's evident you are hitting more than the 1GB configured. The answer probably lies in how you are using Prometheus and what usage limits you are hitting for 1GB. Some of the things you can look at:</p>
<ul>
<li>Number of Time Series</li>
<li>Average Labels Per Time Series</li>
<li>Number of Unique Label Pairs</li>
<li>Scrape Interval (s)</li>
<li>Bytes per Sample</li>
</ul>
<p>You can find a memory calculator for the usage above 👉 <a href="https://www.robustperception.io/how-much-ram-does-prometheus-2-x-need-for-cardinality-and-ingestion" rel="noreferrer">here</a>.</p>
<p>✌️</p>
