在Google Kubernetes Engine中有多少个Pod可以运行一个Kubernetes节点?

时间:2018-11-28 12:04:08

标签: kubernetes google-kubernetes-engine

我在Google Kubernetes引擎(GKE)上运行了多个Node.js应用程序/服务,实际上有8个Pod正在运行。创建Pod时没有设置资源限制,所以现在出现CPU Unscheduled错误。

我知道我必须设置资源限制。据我了解,1 CPU /节点= 1000Mi?我的问题是,

1)我应该设置的理想资源限制是多少?像最低?对于很少使用的Pod,我可以设置20Mi吗?还是50Mi?

2)在单个Kubernetes节点上理想地运行多少个Pod?现在,我设置了2个节点,我希望将其减少到1个。

3)人们在生产中使用什么?和发展集群?

这是我的节点

节点1:

Namespace                  Name                                                    CPU Requests  CPU Limits  Memory Requests  Memory Limits
  ---------                  ----                                                    ------------  ----------  ---------------  -------------
  default                    express-gateway-58dff8647-f2kft                         100m (10%)    0 (0%)      0 (0%)           0 (0%)
  default                    openidconnect-57c48dc448-9jmbn                          100m (10%)    0 (0%)      0 (0%)           0 (0%)
  default                    web-78d87bdb6b-4ldsv                                    100m (10%)    0 (0%)      0 (0%)           0 (0%)
  kube-system                event-exporter-v0.1.9-5c8fb98cdb-tcd68                  0 (0%)        0 (0%)      0 (0%)           0 (0%)
  kube-system                fluentd-gcp-v2.0.17-mhpgb                               100m (10%)    0 (0%)      200Mi (7%)       300Mi (11%)
  kube-system                kube-dns-5df78f75cd-6hdfv                               260m (27%)    0 (0%)      110Mi (4%)       170Mi (6%)
  kube-system                kube-dns-autoscaler-69c5cbdcdd-2v2dj                    20m (2%)      0 (0%)      10Mi (0%)        0 (0%)
  kube-system                kube-proxy-gke-qp-cluster-default-pool-7b00cb40-6z79    100m (10%)    0 (0%)      0 (0%)           0 (0%)
  kube-system                kubernetes-dashboard-7b89cff8-9xnsm                     50m (5%)      100m (10%)  100Mi (3%)       300Mi (11%)
  kube-system                l7-default-backend-57856c5f55-k9wgh                     10m (1%)      10m (1%)    20Mi (0%)        20Mi (0%)
  kube-system                metrics-server-v0.2.1-7f8dd98c8f-5z5zd                  53m (5%)      148m (15%)  154Mi (5%)       404Mi (15%)
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  CPU Requests  CPU Limits  Memory Requests  Memory Limits
  ------------  ----------  ---------------  -------------
  893m (95%)    258m (27%)  594Mi (22%)      1194Mi (45%)

节点2:

 Namespace                  Name                                                    CPU Requests  CPU Limits  Memory Requests  Memory Limits
  ---------                  ----                                                    ------------  ----------  ---------------  -------------
  default                    kube-healthcheck-55bf58578d-p2tn6                       100m (10%)    0 (0%)      0 (0%)           0 (0%)
  default                    pubsub-function-675585cfbf-2qgmh                        100m (10%)    0 (0%)      0 (0%)           0 (0%)
  default                    servicing-84787cfc75-kdbzf                              100m (10%)    0 (0%)      0 (0%)           0 (0%)
  kube-system                fluentd-gcp-v2.0.17-ptnlg                               100m (10%)    0 (0%)      200Mi (7%)       300Mi (11%)
  kube-system                heapster-v1.5.2-7dbb64c4f9-bpc48                        138m (14%)    138m (14%)  301656Ki (11%)   301656Ki (11%)
  kube-system                kube-dns-5df78f75cd-89c5b                               260m (27%)    0 (0%)      110Mi (4%)       170Mi (6%)
  kube-system                kube-proxy-gke-qp-cluster-default-pool-7b00cb40-9n92    100m (10%)    0 (0%)      0 (0%)           0 (0%)
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  CPU Requests  CPU Limits  Memory Requests  Memory Limits
  ------------  ----------  ---------------  -------------
  898m (95%)    138m (14%)  619096Ki (22%)   782936Ki (28%)

我的计划是将所有这些移动到1个节点中。

1 个答案:

答案 0 :(得分:2)

根据kubernetes官方文档

1)您可以降低内存和CPU的数量,但是需要为Pod提供足够的CPU和内存才能正常运行。我对CPU 100和Memory 200的评价很低(这在很大程度上取决于您正在运行的应用程序以及副本的数量)

2)There should not be 100 pods per node(这是极端情况)

3)生产集群在任何情况下都不是单个节点。这是关于kubernetes in production

的很好的阅读

但是请记住,如果增加单个节点上的Pod数量,则可能需要增加节点的大小(in terms of resources)。

内存和CPU使用率往往与集群的大小/负载成比例增长

这是说明要求的官方文件

  

https://kubernetes.io/docs/setup/cluster-large/