Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When a pod can't be scheduled, what does the 3 in "Insufficient cpu (3)" refer to?

When I create a Pod that cannot be scheduled because there are no nodes with sufficient CPU to meet the Pod's CPU request, the events output from kubectl describe pod/... contain a message like No nodes are available that match all of the following predicates:: Insufficient cpu (3).

What does the (3) in Insufficient cpu (3) mean?

For example, if I try to create a pod that requests 24 CPU when all of my nodes only have 4 CPUs:

$ kubectl describe pod/large-cpu-request
Name:           large-cpu-request
Namespace:      default
Node:           /
Labels:         <none>
Annotations:    <none>
Status:         Pending
IP:
Controllers:    <none>
Containers:
  cpuhog:
    ...
    Requests:
      cpu:              24
...
Events:
  FirstSeen     LastSeen        Count   From                    SubObjectPath   Type            Reason                  Message
  ---------     --------        -----   ----                    -------------   --------        ------                  -------
  23m           30s             84      default-scheduler                       Warning         FailedScheduling        No nodes are available that match all of the following predicates:: Insufficient cpu (3).

At other times I have seen event messages like No nodes are available that match all of the following predicates:: Insufficient cpu (2), PodToleratesNodeTaints (1) when a pod's resource requests were too high, so the 3 does not seem like a constant number - nor does it seem related to my 24 CPU request either.

like image 245
matt b Avatar asked Apr 17 '17 20:04

matt b


People also ask

What is POD CPU usage?

Pod CPU use is the aggregate of the CPU use of all containers in a pod. Likewise, pod memory utilization refers to the total aggregate of memory used by all containers in a pod.

How do you get CPU utilization of a pod in Kubernetes?

Get Node CPU usage and memory usage of each node – KubectlThe Simple resource-capacity command with kubectl would return the CPU requests and limits and memory requests and limits of each Node available in the cluster. You can use the --sort cpu. limit flag to sort by the CPU limit.

Why are pods not scheduled on master?

Security pods are not scheduled since the master nodes do not meet the required memory or CPU requirements. The output has the information about memory and CPU requirements. If the resource requirement is not met, increase the master node's memory or CPU.


2 Answers

It means that your Pod doesn't fit on 3 nodes because of Insufficient CPU and 1 node because of taints (likely the master).

like image 95
Janos Lenart Avatar answered Sep 25 '22 18:09

Janos Lenart


A pod can't be scheduled when it requests more cpu than you have in your cluster. For example, if you have 8 Kubernetes CPU (see this page to calculate how many kubernetes cpu you have) in total and if your existing pods have already consumed that much cpu then you can't schedule more pods unless some of your existing pods are killed by the time you request to schedule a new pod. Here is a simple equation can be followed in Horizontal Pod Autoscaler (HPA):

RESOURCE REQUEST CPU * HPA MAX PODS <= Total Kubernetes CPU

You can always tune up these numbers. In my case, I adjusted my manifest file for the RESOURCE REQUEST CPU. It can be 200m, or 1000m (= 1 kubernetes cpu).

like image 33
Abu Shoeb Avatar answered Sep 26 '22 18:09

Abu Shoeb