<p>I am wondering if there is anyway to schedule pods according to the node CPU utilization. Most of our pods in eks are scheduled on single node even though rest of the nodes have lot of CPU left. Our cron-jobs are trying to spin up the new pods in that same node and failing to start because of the low CPU. I believe default kube scheduler should take care of this but it's not happening in our case.</p>
<p>So, Is there such an option as setting pod to schedule according to the CPU Utilization or if we can achieve this with scheduling strategies like node selector/affinity/resource requests&amp;limits etc.,</p>
<p>Thanks in Advance!</p>

<p>The scheduler relies on the CPU request set for the pod and not the CPU usage.</p>
<p>You need to set a CPU request that is high enough so that the scheduler knows that the node already containing a pod is not sufficient and will schedule it on another node that is able to host it.</p>
<p><strong>EDIT:</strong></p>
<p>If you absolutely want to spread your pods over your different nodes, you can use a <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/" rel="nofollow noreferrer">topology-spread-constraint</a></p>
<pre><code>topologySpreadConstraints: 
- maxSkew: 1 
   topologyKey: kubernetes.io/hostname 
   whenUnsatisfiable: ScheduleAnyway 
   labelSelector: 
     matchLabels:
       app: myApp
</code></pre>
<p>Note: with the <code>ScheduleAnyway</code> config, the scheduler will prioritise spreading the pods, and if not possible, it will schedule them anyways. You can also choose not to let him by setting <code>DoNotSchedule</code></p>
