<p>I am trying understand memory requests in k8s. I have observed
that when I set memory request for pod, e.g. nginx, equals 1Gi, it actually consume only 1Mi (I have checked it with <code>kubectl top pods</code>). My question. I have 2Gi RAM on node and set
memory requests for pod1 and pod2 equal 1.5Gi, but they actually consume only 1Mi of memory. I start pod1 and it should be started, cause node has 2Gi memory and pod1 requests only 1.5Gi. But what happens If I try to start pod2 after that? Would it be started? I am not sure, cause pod1 consumes only 1Mi of memory but has request for 1.5Gi. Do memory request of pod1 influences on execution of pod2? How k8s will rule this situation?</p>

Kirill Bugaev
<p>In Kubernetes you decide on Pod/Container memory using two parameters:</p>

<ul>
<li><code>spec.containers[].resources.requests.memory</code>: Kubernetes scheduler will not schedule your Pod if there is not enough memory, this memory is also reserved for you container</li>
<li><code>spec.containers[].resources.limits.memory</code>: Container cannot exceed this memory</li>
</ul>

<p>If you want to be precise about the memory for you container, then you'd better set the same value for both parameters.</p>

<p><a href="https://sysdig.com/blog/kubernetes-limits-requests/" rel="nofollow noreferrer">This</a> is a very good article explaining by example. And here's the <a href="https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container" rel="nofollow noreferrer">official doc</a>.</p>
