【问题标题】:Unreasonable not enough CPU for deployment scaling不合理的没有足够的 CPU 用于部署扩展
【发布时间】:2019-11-07 14:58:40
【问题描述】:

我正在尝试了解使用负载均衡器进行部署扩展。我在谷歌云上创建了 Kubernetes 集群,有 6 个节点:2 个内核和 13Gb RAM(n1-highmem-2),并启动了 5 个 Pod 和 1 个负载均衡器服务。每个 Pod 都有一个指定为 5.1Gb 和 1cpu 的限制。当我尝试将我的部署扩展到 10 个 Pod 时,我收到一个错误,即我的 CPU 数量太低。如何?我的集群总共有 12 个内核和 78Gb 的 RAM。这是我的 yaml 文件:

apiVersion: v1
kind: Namespace
metadata:
   name: production
   labels:
      name: production
---
apiVersion: v1
kind: Service
metadata:
   name: my-service
   namespace: production
   labels:
      run: mypod
spec:
   type: LoadBalancer
   ports:
      - port: 8050
        targetPort: 8050
        protocol: TCP
        name: http
   selector:
      run: mypod
---
apiVersion: apps/v1
kind: Deployment
metadata:
   name: test
   namespace: production
spec:
   selector:
      matchLabels:
         run: mypod
   replicas: 5
   template:
      metadata:
         namespace: production
         labels:
            run: mypod
      spec:
         containers:
            - name: test
              image: my-hello-world
              ports:
              - containerPort: 8050
              resources:
                 limits:
                    cpu: "1"
                    memory: "5.1Gi"
                 requests:
                    cpu: "1"
                    memory: "500Mi"

【问题讨论】:

    标签: kubernetes google-kubernetes-engine


    【解决方案1】:

    其他容器可能正在向您的集群请求 CPU(包括 kube-system 容器)。

    您为每个 test 容器副本请求 1 个 CPU,但请记住,每个容器必须在其中一个节点中调度(即每个单个节点只有 2 个可用 CPU)。这意味着:如果一个节点有一个 kube-system 容器请求任意数量的 CPU,则该节点不能承受多个 test 容器。例如:

    节点 1:

    • calico-node-rqcw7 - 250m
    • test-83h1d - 1000m
    • test-kd93h - 1000m #

    使用kubectl describe nodes 命令,你应该弄清楚哪些容器被调度在哪些节点中,包括它们的 CPU 请求。

    【讨论】:

    • 感谢您的回答!大概就是这样。我完全忘记了必须有一个管理资源的流程
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-15
    • 2011-03-03
    • 1970-01-01
    • 2014-03-16
    相关资源
    最近更新 更多