<p>In my Kubernetes 1.11 cluster a MySQL pod is getting killed due to <code>Out of memory</code> issue:</p>

<pre><code>&gt; kernel: Out of memory: Kill process 8514 (mysqld) score 1011 or
&gt; sacrifice child kernel: Killed process 8514 (mysqld)
&gt; total-vm:2019624kB, anon-rss:392216kB, file-rss:0kB, shmem-rss:0kB
&gt; kernel: java invoked oom-killer: gfp_mask=0x201da, order=0,
&gt; oom_score_adj=828 kernel: java
&gt; cpuset=dab20a22eebc2a23577c05d07fcb90116a4afa789050eb91f0b8c2747267d18e
&gt; mems_allowed=0 kernel: CPU: 1 PID: 28667 Comm: java Kdump: loaded Not
&gt; tainted 3.10.0-862.3.3.el7.x86_64 #1 kernel
</code></pre>

<p>My questions:</p>

<ol>
<li>How to prevent that my pod gets OOM-killed? Is there a deployment setting I need to enable?</li>
<li>What is the configuration to prevent new pod getting scheduled on a node, when there is not enough memory available on said node?</li>
<li>We disabled the swap space. Do we need to disable memory overcommitting setting on the host level, setting <code>/proc/sys/vm/overcommit_memory</code> to <code>0</code>?</li>
</ol>

<p>Thanks
SR</p>

sfgroups
<p>When defining a Pod manifest it's a best practice to define <code>resources</code> section with <code>limits</code> and <code>requests</code> for CPU and memory:</p>

<pre><code>resources:
    limits:
      cpu: "1"
      memory: 512Mi
    requests:
      cpu: 500m
      memory: 256Mi
</code></pre>

<p>This definition helps the scheduler identifying three Quality of Service (<a href="https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/" rel="nofollow noreferrer">QoS</a>) categories:</p>

<ul>
<li><p>Guaranteed</p></li>
<li><p>Burstable</p></li>
<li><p>BestEffort</p></li>
</ul>

<p>and pods in the last category are the most expendable.</p>
