<p>There are two examples on kubernetes.io about how to specify memory request and limits and they are very confusing.</p>
<p>(I removed <code>cpu</code> and the unnecessary quote characters from the following examples.)</p>
<p><strong>Example 1:</strong></p>
<p><a href="https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/</a></p>
<pre><code>resources:
  requests:
    memory: 64Mi
  limits:
    memory: 128Mi
</code></pre>
<p><strong>Example 2:</strong></p>
<p><a href="https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/</a></p>
<pre><code>resources:
  limits:
    memory: 200Mi
  requests:
    memory: 100Mi
</code></pre>
<p>Both examples are valid expressions but when using power-of-two suffix shouldn't you aim for always using <code>8</code>, <code>16</code>, <code>32</code>, <code>64</code>, <code>128</code>, <code>256</code>, <code>512</code>, <code>1028</code> and so on?</p>
<p>I think that the person from example nr 2 didn't really know what she/he was doing and she/he should have used fixed-point suffix, <code>200M</code> and <code>100M</code>, instead?</p>
<p>If I were to specify <code>268435456</code> bytes using power-of-two suffix how would I express that in my yaml config; <code>250Mi</code> or <code>256Mi</code>?</p>

PussInBoots
<blockquote>
<p>I think that the person from example nr 2 didn't really know what she/he was doing and she/he should have used fixed-point suffix, 200M and 100M, instead?</p>
</blockquote>
<p>No. <code>Mi</code> and <code>M</code> are units representing certain number of bytes. <code>Mi</code> is (2<sup>10)<sup>2</sup></sup> bytes  (1048576 bytes) and <code>M</code> is (10<sup>3)<sup>2</sup></sup> bytes (1000000 bytes). The number you place before these units doesn't matter except for as a multiplication factor. There is no requirement that the prefix number should be a multiple of two or anything.</p>
<p>200M = 200 x (10<sup>3)<sup>2</sup></sup> bytes = 200000000 bytes</p>
<p>200Mi = 200 x (2<sup>10)<sup>2</sup></sup> bytes = 209715200 bytes</p>
<hr />
<blockquote>
<p>If I were to specify 268435456 bytes using power-of-two suffix how would I express that in my yaml config; 250Mi or 256Mi?</p>
</blockquote>
<p>268435456 bytes = 268435456/1048576 Mi = 256Mi</p>
<p>268435456 bytes = 268435456/1000000 M = 268.435456M</p>
<hr />
<p>From <a href="https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory" rel="nofollow noreferrer">docs</a></p>
<blockquote>
<p>Limits and requests for memory are measured in bytes. You can express memory as a plain integer or as a fixed-point number using one of these suffixes: E, P, T, G, M, K. You can also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki. For example, the following represent roughly the same value:</p>
<p>128974848, 129e6, 129M, 123Mi</p>
</blockquote>
