<p>I'm running a pod on an EKS node with 2500m of requests and no limits - it happily uses around 3000m typically. I wanted to test whether requests were really guaranteed, so I am running a CPU stress test pod on the same node, with 3000m requests and no limits again.</p>
<p>This caused the original pod to not be able to use more than ~1500m of CPU - well below it's requests. Then when I turned off the stress pod, it returned to using 3000m.</p>
<p>There are a number of Kubernetes webpages which say that requests are what the pod is &quot;guaranteed&quot; - but does this only mean guaranteed for scheduling, or should it actually be a guarantee. If it is guaranteed, why might my pod CPU usage have been restricted (noting that there is no throttling for pods without limits).</p>

unclemeat
<p>Requests are not a guarantee that resources (especially CPU) will be available at runtime.  If you set requests and limits very close together you have better expectations, but you need every pod in the system to cooperate to have a real guarantee.</p>
<p>Resource requests only affect the initial scheduling of the pod.  In your example, you have one pod that requests 2.5 CPU and a second pod that requests 3 CPU.  If your node has 8 CPU, both can be scheduled on the same node, but if the node only has 4 CPU, they need to go on separate nodes (if you have the cluster autoscaler, it can create a new node).</p>
<p>To carry on with the example, let's say the pods get scheduled on the same node with 8 CPU.  Now that they've been scheduled the resource requests don't matter any more.  Neither pod has resource limits, but let's say the smaller pod actually tries to use 3 CPU and the larger pod (a multi-threaded stress test) uses 13 CPU.  This is more than the physical capacity of the system, so the kernel will allocate processor cycles to the two processes.</p>
<p>For CPU usage, if the node is overcommitted, you'll just see slow-downs in all of the processes.  Either memory or disk (&quot;ephemeral storage&quot;) can cause pods to be Evicted and rescheduled on different nodes; the pods that get evicted are the ones that exceed their resource requests by the most.  Memory can also cause the node to run out of physical memory, and pods can get OOMKilled.</p>
<p>If <em>every</em> pod sets resource requests and limits to the same value then you do have an approximate guarantee that resources will be available, since nothing will be able to use more resource than the pod scheduler allocates it.  For an individual pod and for non-CPU resources, if resource requests and limits are the same, your pod won't get evicted if the node is overcommitted (because it can't exceed its requests).  On the other hand, most processes won't generally use <em>exactly</em> their resource requests, and so setting requests high enough that you're guaranteed to not be evicted also means you're causing the node to have unused resources, and your cluster as a whole will be less efficient (need more nodes to do the same work and be more expensive) (but more reliable since pods won't get killed off as often).</p>
