[英]How can we limit the number of pods in a given worker node (VM) based on memory utilization parameter and trigger scaling of nodes
I have a Kubernetes cluster with following configuration (giving only relevant info)我有一个具有以下配置的 Kubernetes 集群(仅提供相关信息)
I have two worker nodes with c5.xlarge configuration (c5.xlarge 4vCPU 8GiB Memory).我有两个配置为 c5.xlarge 的工作节点(c5.xlarge 4vCPU 8GiB 内存)。 To clarify these are two EC2 VMs on Amazon AWS.
为了澄清这些是 Amazon AWS 上的两个 EC2 虚拟机。
I am running a backend application on both the nodes我在两个节点上运行后端应用程序
When the memory utilization of any node (VM) reaches 80%, i want the node to stop spawning any more pods当任何节点 (VM) 的 memory 利用率达到 80% 时,我希望该节点停止生成更多 pod
Naturally, I would want a new node (VM) to spawn up automatically if both of my existing VM's are at 80% memory threshold.当然,如果我现有的两个 VM 都处于 80% memory 阈值,我希望自动生成一个新节点 (VM)。
question It gives a way to achieve but there is no memory parameter involved. 问题它提供了一种实现方法,但没有涉及 memory 参数。
You need to scale in 2 levels.您需要扩展 2 个级别。
Pod level autoscaling. Pod 级别的自动缩放。 This can be achieved by using the HPA ( Horizontal Pod Autoscaler ).
这可以通过使用 HPA( Horizontal Pod Autoscaler )来实现。 You can set a scaling policy based on CPU and/or Memory metric.
您可以根据 CPU 和/或 Memory 指标设置扩展策略。
You have to set node level autoscaling.您必须设置节点级别的自动缩放。 Ref: 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.
Kubernetes Cluster Autoscaler 在 pod 由于资源不足而无法启动或集群中的节点未充分利用并且它们的 pod 可以重新调度到集群中的其他节点时自动调整集群中的节点数量。
Also, note that the cluster autoscaler decide when to scale out and scale in based on the resource availability (Memory or CPU).另外,请注意,集群自动缩放器会根据资源可用性(内存或 CPU)决定何时向外扩展和缩减。 I don't think you can set a 80% memory threshold as a scaling policy here.
我认为您不能在此处设置 80% memory 阈值作为扩展策略。
AWS EKS Documentation for scaling AWS EKS Autoscaling用于扩展的 AWS EKS 文档AWS EKS Autoscaling
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.