简体   繁体   English

减少kubectl规模的等待时间

[英]Reduce wait-time for kubectl scale

Need to scale nodes down instantly, Kubernetes doesn't allow developers to configure the time before a node scales down. 需要立即缩小节点规模,Kubernetes不允许开发人员配置节点缩小规模之前的时间。 Currently, it has an unconfigurable default of 10 minutes. 当前,它具有10分钟的不可配置默认值。

I'm developing an application which requires a lot of compute power/ hours. 我正在开发一个需要大量计算能力/小时的应用程序。 I'm looking at running process A, which adds some tasks to a job queue. 我正在运行A,它将一些任务添加到作业队列中。 Each of the jobs' require an average 10-40 mins for processing on a 6vCPU and 24GB instance. 每个作业平均需要10-40分钟才能在6vCPU和24GB实例上进行处理。

When you apply kubectl scale deployment <deployment-name> it scales the pods down instantly. 当您应用kubectl scale deployment <deployment-name>它将立即缩小kubectl scale deployment <deployment-name> However, the underlying node will only scale down if no processing power has been used for 10 minutes. 但是,只有在10分钟内未使用任何处理能力时,基础节点才会按比例缩小。

Is there anyway to configure this wait-time? 无论如何,有没有配置这个等待时间? Is it worth it to contact Google GKE or Kubernetes to allow an exception for my particular use-case? 联系Google GKE或Kubernetes允许我的特定用例例外是值得的吗?

I also attempted to kill the node myself from within the pod after processing and was successful, however, Kubernetes recreates the deleted instance so my attempt was useless. 我还尝试在处理后自己从Pod中杀死该节点,并成功了,但是,Kubernetes重新创建了删除的实例,因此我的尝试没有用。

Any advice​ would be appreciated. 任何建议将不胜感激。

kubectl scale deployments mydeployment --replica=0

Actual: Scales pods down immediately but scales the underlying node down after 10 minutes. 实际:立即将Pod缩小,但是在10分钟后将基础节点缩小。 Requred: Scales pods and nodes down instantly. 随机:立即缩小Pod和节点。

It seems option like "-scale-down-unneeded-time_" is not supported. 似乎不支持“ -scale-down-unneeded-time_”之类的选项。 As workaround - If you're sure you're done with the node and no longer need it, you can scale down the GKE node pool manually, without waiting for Cluster Autoscaler to reclaim it automatically. 解决方法-如果您确定已完成节点的使用并且不再需要它,则可以手动缩小GKE节点池,而无需等待Cluster Autoscaler自动回收它。 A command to do that can be found here 可以在此处找到执行操作的命令

However, this way you cannot control which node exactly will be turned down . 但是,通过这种方式,您无法控制将确切关闭哪个节点

If you have a short-lived workload that occupies an entire VM and you want to turn down the VM as soon as it's done, you don't need Kubernetes, it will only get in the way. 如果您的工作负载短暂且仅占用整个VM,并且您想在完成后立即关闭VM,则不需要Kubernetes,只会遇到麻烦。 The best way to achieve this is to create a VMs on Compute Engine for every task, and turn each VM down as soon as it's done. 实现此目的的最佳方法是在Compute Engine上为每个任务创建一个VM,并在完成后立即将其关闭。 Just make sure you put everything required to run the task in the VM image so you don't waste time downloading and installing stuff on startup. 只需确保将运行任务所需的所有内容都放入VM映像中即可,这样就不会浪费时间在启动时下载和安装内容。

Hope This help. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM