<p>What is a simple explanation to resource allocation and definitions in kubernetes?
What does it mean to allocate "1000m" CPU units and 1024Mi off memory?</p>

Amir Mehler
<p>(tried to write it in simpler language than the official <a href="https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/" rel="noreferrer">docs</a>)</p>

<p><strong>CPU</strong> </p>

<p>In Kubernetes each CPU core is allocated in units of one "milicore" meaning one Virtual Core (on a virtual machine) can be divided into 1000 shares of 1 milicore. Allocating 1000 milicores will give a pod one full CPU. Giving more will require the code in the pod to able to utilize more than one core.</p>

<p><strong>Memory</strong></p>

<p>Very simple. Each Megabyte you allocate is reserved for the pod.</p>

<p><strong>Requests</strong></p>

<p>Minimal resources that are guaranteed to be given to the pod. If there are not enough resources to start a pod on any node it will remain in "Pending" state.</p>

<p><strong>Limits</strong></p>

<p><strong>CPU Limit</strong> Will cause the the pod to throttle down when hitting the limit.</p>

<p><strong>Memory Limit</strong> When a pod utilizes all of it's memory and asks for more than the limit <em>it will considered a memory leak</em> and the pod will get restarted.</p>

<p><strong>Target</strong> (defined in the Horizontal Pod Autoscaler)</p>

<p>Can be applied to CPU, Memory and other custom metrics (more complicated to define.</p>

<p>It's might be a good idea to set resources for a pod in sizes of <strong>A</strong> <strong>B</strong> and <strong>C</strong> where: A &lt; B &lt; C. With requests = A, Target = B and Limits = C.
Just remember that a fully loaded node might prevent pods from reaching their "target" and not never scale up. </p>
