Insufficient cpu in Kubernetes multi node cluster
A Pod is scheduled on a single Node. The resource requests:
help decide where it can be scheduled. If you say requests: {cpu: 11}
then there must be some single node with 11 (unreserved) cores available; but if your cluster only has 8-core m4.2xlarge nodes, no single node will be able to support this. Kubernetes can’t “aggregate” cores across nodes in any useful way at this level.
If you’re requesting a lot of CPU because your process has a lot of threads to do concurrent processing, consider turning the number of threads down (maybe even to just 1) but then changing the replicas:
in a Deployment spec to run many copies of it. Each individual Pod will get scheduled on a single Node, but with many replicas you’ll get many Pods which can be spread across the three Nodes.
If your process really needs more than 8 cores to run, then you need individual systems with more than 8 cores; consider an m4.4xlarge (same RAM-to-CPU ratio) or a c4.4xlarge (same total RAM, twice the cores).
When you specify a limit
or request
for a pod, it takes into account per node capacity of CPU or memory. In other words you can't have a Pod requesting more CPU or Memory which is available on a single worker node of your cluster, if you do it will go in Pending
state and will not come up until it finds a node matching the request
of the Pod.
In your case, worker node of size m4.2xlarge
has 8 vCPUs, and in the deployment file you have requesed 11 vCPUs for the Pod. This will never work even though you have 3 nodes of size m4.2xlarge. A Pod always get scheduled on a single worker Node so it doesn't matter if the aggregate CPU capacity of your cluster is more than 11 vCPUs because a Pod will only be able to consume resources from a single worker node.
Hope this helps!