I'm currently running a Kubernetes cluster on a n1 standard1 node (1vCPU and 3.75GB memory).I tried to deploy 4 workloads.
I have set resource request and limit as 100m and 128Mi (for container) for each deployment, but when I tried to deploy my 3rd pod, I keep getting not having enough CPU availability even the node is using only 9% CPU at the same time.
Does anyone know what might be going on? Any response would be appreciated!
Best Answer
The most probable cause that the following error is showing:
Is that there are some objects (like
Pods
) not allocated inside of the cluster.There are some links referencing the same message:
Focusing specifically on the example showed in the question.
The setup is following:
GKE
node with:1 vCPU
and3.75
GB ofRAM
The resources scheduled onto this single node cluster:
Deployments
where each have following fields:For an example I tried to replicate setup as close as possible to the one in the question:
$ kubectl get pods
As you can see there is a
Pod
that is inPending
state. Further investigation implies:$ kubectl describe pod/nginx-four-99d88fccb-v664b
A lot of information will show about the
Pod
but the part that needs to be checked isEvents
:As you can see from above output:
FailedScheduling: ... 0/1 nodes are available: 1 Insufficient cpu
As posted in the question:
This CPU availability is strictly connected to the Allocated resources. You can have CPU usage in the midst of 10% and still run into
Insufficient CPU
messages. Here is why:Take a look on the
resources.requests
section in the part ofDeployment
I included earlier. It is specified there that eachPod
in theDeployment
want a guarantee that100m
ofCPU
time will be available in the cluster. 4x100m
=400m
.If you run (after applying the workload):
$ kubectl describe node
There is already allocated the
939M
CPU from a1000M
(3/4
Pods
are scheduled). That's why one of thePod
cannot be scheduled (even when theCPU
usage is 10%).To fix that you can either:
.resources.requests
sectionrequests
andlimits
Additional resources: