<p>Kubernetes allows to specify the cpu <a href="https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/" rel="noreferrer">limit and/or request</a> for a POD.</p>

<p>Limits and requests for CPU resources are measured in <em>cpu units</em>. One cpu, in Kubernetes, is equivalent to:</p>

<pre><code>1 AWS vCPU
1 GCP Core
1 Azure vCore
1 IBM vCPU
1 Hyperthread on a bare-metal Intel processor with Hyperthreading
</code></pre>

<p>Unfortunately, when using an heterogeneous cluster (for instance with different processors), the <em>cpu limit/request</em> depends on the node on which the POD is assigned; especially for real time applications.</p>

<p>If we assume that:</p>

<ul>
<li>we can compute a fined tuned cpu limit for the POD for each kind of hardware of the cluster</li>
<li>we want to let the Kubernetes scheduler choose a matching node in the whole cluster</li>
</ul>

<p>Is there a way to launch the POD so that the cpu limit/request depends on the node chosen by the Kubernetes scheduler (or a Node label)?</p>

<p>The obtained behavior should be (or equivalent to):</p>

<ul>
<li>Before assigning the POD, the scheduler chooses the node by checking different cpu requests depending on the Node (or a Node Label)</li>
<li>At runtime, Kublet checks a specific cpu limit depending on the Node (or a Node Label)</li>
</ul>

<p>No, you can't have different requests per node type. What you can do is create a pod manifest with a node affinity for a specific kind of node, and requests which makes sense for that node type. For a second kind of node, you will need a second pod manifest which makes sense for that node type. These pod manifests will differ only in their affinity spec and resource requests - so it would be handy to parameterize them. You could do this with Helm, or write a simple script to do it.</p>

<p>This approach would let you launch a pod within a subset of your nodes with resource requests which make sense on those nodes, but there's no way to globally adjust its requests/limits based on where it ends up.</p>
