<p>The container set resource limit：</p>

<pre><code>resources:
      limits:
        cpu: "1"
        memory: 1G
      requests:
        cpu: "1"
        memory: 1G
</code></pre>

<p>the cgroup memory limit:</p>

<pre><code>cat /sys/fs/cgroup/memory/kubepods.slice/kubepods-podaace5b66_c7d0_11e9_ba2a_dcf401d01e81.slice/memory.limit_in_bytes 
999997440
</code></pre>

<p>1GB= 1*1024*1024*1024=1,073,741,824B</p>

<p>k8s version:1.14.4</p>

<p>docker version:  docker-ce-18.09.6
OS: ubuntu 18.04</p>

wow qing
<p>I have performed some tests.</p>

<p>For the values between 999997440 B (976560 KB) and 1000000000 B (as in your example) you will have the same results in memory.limit_in_bytes = 999997440 B.
Till you reach the next (integer) number of bytes divisible by your pagesize (default 4096). In my example it was 1000001536 B (976564K).</p>

<p>I am not linux expert but according to the <a href="https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt" rel="nofollow noreferrer">documentation</a>: </p>

<blockquote>
  <p>A successful write to this file does not guarantee a successful setting of
  this limit to the value written into the file. This can be due to a
  number of factors, such as rounding up to page boundaries or the total
  availability of memory on the system. The user is required to re-read
  this file after a write to guarantee the value committed by the kernel.</p>
</blockquote>

<p>I would like to suggest use Gi notation instead as mentioned by <a href="https://stackoverflow.com/a/57761069/11207414">prometherion</a> to have more control about  resources limits.</p>

<p>Hope this help.</p>
