尽管启用了自动缩放,但节点池不会将其节点大小减小为零 [英] Node pool does not reduce his node size to zero although autoscaling is enabled

查看:79
本文介绍了尽管启用了自动缩放,但节点池不会将其节点大小减小为零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了两个节点池.一小笔用于所有google系统工作,一笔大用于我的任务.作业完成后,较大的应将其大小减小为0.

I have created two node pools. A small one for all the google system jobs and a bigger one for my tasks. The bigger one should reduce its size to 0 after the job is done.

问题是::即使没有cron作业,节点池也不会 将他的尺寸减小到0.

The problem is: Even if there are no cron jobs, the node pool do not reduce his size to 0.

创建集群:

gcloud beta container --project "projectXY" clusters create "cluster" --zone "europe-west3-a" --username "admin" --cluster-version "1.9.6-gke.0" --machine-type "n1-standard-1" --image-type "COS" --disk-size "100" --scopes "https://www.googleapis.com/auth/cloud-platform" --num-nodes "1" --network "default" --enable-cloud-logging --enable-cloud-monitoring --subnetwork "default" --enable-autoscaling --enable-autoupgrade --min-nodes "1" --max-nodes "1"

创建节点池:

完成所有任务后,节点池的大小应减小为0.

The node pool should reduce its size to 0 after all tasks are done.

gcloud container node-pools create workerpool --cluster=cluster --machine-type="n1-highmem-8", -m "n1-highmem-8" --zone=europe-west3-a, -z europe-west3-a --disk-size=100 --enable-autoupgrade --num-nodes=0 --enable-autoscaling --max-nodes=2 --min-nodes=0

创建Cron作业:

kubectl create -f cronjob.yaml

推荐答案

从Google引用

"注意:从Kubernetes 1.7版开始,您可以为节点池指定最小大小为零.如果不需要其中的实例来运行工作负载,这可以使节点池完全缩小.一个节点池可以扩展到零大小,整个群集大小不能缩减到零个节点(因为运行系统Pod总是需要至少一个节点)."

"Note: Beginning with Kubernetes version 1.7, you can specify a minimum size of zero for your node pool. This allows your node pool to scale down completely if the instances within aren't required to run your workloads. However, while a node pool can scale to a zero size, the overall cluster size does not scale down to zero nodes (as at least one node is always required to run system Pods)."

还请注意:

集群自动缩放器还会根据节点池的总容量需求来衡量每个节点的使用情况.如果一个节点在设定的时间内没有安排新的Pod,并且 [此选项不起作用对您来说,因为它是最后一个节点] ,因此可以将该节点上运行的所有Pod调度到池中的其他节点上,自动缩放器将Pod移至该节点上并删除该节点.

"Cluster autoscaler also measures the usage of each node against the node pool's total demand for capacity. If a node has had no new Pods scheduled on it for a set period of time, and [this option does not work for you since it is the last node] all Pods running on that node can be scheduled onto other nodes in the pool , the autoscaler moves the Pods and deletes the node.

请注意,集群自动缩放器根据Pod资源请求(即Pod请求了多少资源)工作.群集自动缩放器未考虑您Pod正在使用的资源.本质上,集群自动缩放器相信您提供的Pod资源请求是准确的,并基于该假设在节点上调度Pod."

Note that cluster autoscaler works based on Pod resource requests, that is, how many resources your Pods have requested. Cluster autoscaler does not take into account the resources your Pods are actively using. Essentially, cluster autoscaler trusts that the Pod resource requests you've provided are accurate and schedules Pods on nodes based on that assumption."

因此,我将检查:

  • 您的Kubernetes集群版本至少为1.7
  • 最后一个节点上没有Pod(检查每个命名空间,必须在每个节点上运行的Pod不计数:fluentd,kube-dns,kube-proxy),没有cronjobs的事实是还不够
  • 已为相应的托管实例组启用了自动缩放器,因为它们是不同的工具
  • 没有分配到该节点的怪异状态的豆荚
  • 集群中没有等待调度的Pod
  • that your version of your Kubernetes cluster is at least 1.7
  • that there are no pods running on the last node (check every namespace, the pods that have to run on every node do no count: fluentd, kube-dns, kube-proxy), the fact that there are no cronjobs is not enough
  • that for the autoscaler is NOT enabled for the corresponding managed instance groups since they are different tools
  • that there are no pods stuck in any weird state still assigned to that node
  • that there is no pods waiting to be scheduled in the cluster

如果仍然很可能是自动缩放器存在问题,则可以打开私人问题,因为社区无能为力,因此请指定您在Google的项目ID.

If still everything likely it is an issue with the autoscaler and you can either open a private issue specifying your project ID with Google since there is not much the community can do.

如果您对注释感兴趣,请使用问题跟踪器的链接,我将在您的项目中进行研究(我为Google Cloud Platform支持工作)

If you are interested place in the comments the link of the issue tracker and I will take a look in your project (I work for Google Cloud Platform Support)

这篇关于尽管启用了自动缩放,但节点池不会将其节点大小减小为零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆