<p>For better understand my doubts, I will put an example</p>
<p>Example:</p>
<p>We have one worker node with 3 allocatable cpus and kubernetes has scheduled three pods on it:</p>
<ul>
<li>pod_1 with 500m cpu request</li>
<li>pod_2 with 700m cpu request</li>
<li>pod_3 with 300m cpu request</li>
</ul>
<p>In this worker node I can't schedule other pods.</p>
<p>But if I check the real usage:</p>
<ul>
<li>pod_1 cpu usage is 300m</li>
<li>pod_2: cpu usage is 600m</li>
</ul>
<p>My question is:</p>
<p>Can pod_3 have a real usage of 500m or the request of other pods will limit the cpu usage?</p>
<p>Thanks</p>
<p>Pietro</p>

P3pp3r
<p>Kubernetes will schedule the pods based on the <code>request</code> that you configure for the container(s) of pod (via the specs for the respective <code>Deployment</code> or other <code>kind</code>s).</p>
<p>Here's an example:</p>
<p>For simplicity, let's assume only one container for the pod.</p>
<pre><code>  containers:
  - name: &quot;foobar&quot;
    resources:
      requests:
        cpu: &quot;300m&quot;
        memory: &quot;256Mi&quot;
      limits:
        cpu: &quot;500m&quot;
        memory: &quot;512Mi&quot;
</code></pre>
<p>If you ask for <code>300</code> millicpus as your <em>request</em>, Kubernetes will place the pod on a node that has <em>at least</em> <code>300</code> millicpus allocatable to that pod. If a node has less allocatable CPU available, the pod will not be placed on that node. Similarly, you can also set the value for <code>memory</code> request as well.</p>
<p>The <code>limit</code> works to <em>limit</em> the resource use by the container. In the example above, Kubernetes will evict the pod if the container ends up <em>using</em> more than 512MiB of memory; once evicted, the pod will be placed on a node that has at least <code>300</code> millicpus available (and if no such node exists, the pod will remain in <code>Pending</code> state with <code>FailedScheduling</code> as the reason, until a node with sufficient capacity is available).</p>
<p>Do note, that the resource <code>request</code> works only at the time of pod <em>scheduling</em>, and not at <em>runtime</em> (meaning, the <em>actual consumption</em> of the resources will not trigger a re-scheduling of the pod even if the container used more resources than what it requested as long as it remains below the <code>limit</code>, if specified).</p>
<p><a href="https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#how-pods-with-resource-requests-are-scheduled" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#how-pods-with-resource-requests-are-scheduled</a></p>
<p>So, in summary,</p>
<ul>
<li>The total of all your <code>request</code>s is used as the what can be allocated regardless of the actual runtime utilization of your pod (as long as the limit is not crossed)</li>
<li>You can <code>request</code> for 300 millicpus, but only use 100 millicpus, or 400 millicpus; Kubernetes will still show the &quot;allocated&quot; value as 300</li>
<li>If your container crosses the limit, it will get evicted by Kubernetes</li>
</ul>
