我们如何根据内存利用率参数和触发节点缩放来限制给定工作节点 (VM) 中 pods 的数量

How can we limit the number of pods in a given worker node (VM) based on memory utilization parameter and trigger scaling of nodes

规格

我有一个具有以下配置的 Kubernetes 集群(仅提供相关信息)

要求

  1. 当任何节点(VM)的内存使用率达到80%时,我希望该节点不再生成pods

  2. 当然,如果我现有的两个 VM 都处于 80% 的内存阈值,我希望自动生成一个新节点 (VM)。

已经通过

给出了一种实现方式,但是没有涉及到内存参数。

您需要分 2 个级别进行缩放。

  1. Pod 级自动缩放。这可以通过使用 HPA (Horizontal Pod Autoscaler) 来实现。您可以根据 CPU and/or 内存指标设置扩展策略。

  2. 您必须设置节点级别的自动缩放。参考:Cluster Autoscaler

The Kubernetes Cluster Autoscaler automatically adjusts the number of nodes in your cluster when pods fail to launch due to lack of resources or when nodes in the cluster are underutilized and their pods can be rescheduled onto other nodes in the cluster.

另外请注意,集群自动缩放程序根据资源可用性(内存或 CPU)决定何时扩展和缩减。我认为您不能在此处将 80% 的内存阈值设置为扩展策略。

AWS EKS 扩展文档AWS EKS Autoscaling