当无法安排pod时,"insufficient cpu(3)"中的3指的是什么?

mat*_*t b 16 kubernetes google-kubernetes-engine

当我创建一个无法调度的Pod,因为没有足够CPU的节点来满足Pod的CPU请求时,输出的事件kubectl describe pod/...包含一条消息No nodes are available that match all of the following predicates:: Insufficient cpu (3).

什么是(3)Insufficient cpu (3)意味着什么?

例如,如果我尝试创建一个在我的所有节点只有4个CPU时请求24个CPU的pod:

$ 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).
Run Code Online (Sandbox Code Playgroud)

在其他时候,我已经看到了事件消息,例如No nodes are available that match all of the following predicates:: Insufficient cpu (2), PodToleratesNodeTaints (1)当pod的资源请求太高时,所以3看起来不像一个常数 - 也不像我的24 CPU请求.

Jan*_*art 13

这意味着你的Pod不适合3个节点,因为CPU和1个节点因为taints(可能是主节点)而不适合.

  • 嗯,不是我所知道的.据说,这是易于阅读的消息!:-D https://github.com/kubernetes/kubernetes/issues/20064 (2认同)

Abu*_*oeb 5

当 Pod 请求的 CPU 超过集群中的 CPU 时,无法调度 Pod。例如,如果您总共有 8 个 Kubernetes CPU(请参阅此页面以计算您拥有多少 kubernetes cpu)并且如果您现有的 pod 已经消耗了那么多的 cpu,那么您无法安排更多的 pod,除非您现有的一些 pod 是在您请求安排新 Pod 时终止。这是一个可以在 Horizo​​ntal Pod Autoscaler (HPA) 中遵循的简单公式:

资源请求 CPU * HPA MAX PODS <= Kubernetes CPU 总数

您可以随时调整这些数字。就我而言,我为 RESOURCE REQUEST CPU调整了清单文件。它可以是 200m 或 1000m(= 1 kubernetes cpu)。