Kubernetes Autoscaler 如何始终保持一个节点空闲

Kubernetes Autoscaler how to always keep one node at idle

我目前正在使用 GPU,由于它们很昂贵,我希望它们能够根据负载进行缩小和放大。然而,扩展集群和准备节点大约需要 8 分钟,因为它安装了驱动程序并进行了一些其他准备工作。

所以为了解决这个问题,我想让一个节点保持空闲状态并自动缩放其余节点。有什么办法吗?

这样当一个请求来的时候,空闲节点会接受它,并创建一个新的空闲节点。

谢谢!

共有三种不同的方法:

1 - 第一种方法完全是手动的。这将帮助您将节点保持在空闲状态,而不会在自动缩放过程中导致应用程序停机。

您必须阻止一个特定节点自动销售(我们称之为 "node A")。创建一个新节点并将节点 A pods 的副本复制到该新节点。 该节点将 运行ning 而不是自动缩放过程的一部分。 自动缩放过程完成并启动完成后,您可以安全地耗尽该节点。

 a. Create a new node. 
 b. Prevent node A from evicting its pods by adding the annotation "cluster-autoscaler.kubernetes.io/safe-to-evict": "false"
 c. Copy a replica of node A, make replicas of the pods into that new node. 
 d. Once the autoscaler has scaled all the nodes, and the boot time has
    completed, you may safely drain node A, and delete it.

2 - 你可以 运行 一个 Pod Disruption Budget.

3 - 如果您想阻止节点 A 在自动缩放器缩减时被删除,you could set the annotation "cluster-autoscaler.kubernetes.io/scale-down-disabled": "true" 在一个特定节点上。这仅在缩小过程中有效。