简体   繁体   English

我们如何根据 memory 利用率参数限制给定工作节点 (VM) 中的 pod 数量并触发节点扩展

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

Specs眼镜

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我在两个节点上运行后端应用程序

Requirement要求

  1. When the memory utilization of any node (VM) reaches 80%, i want the node to stop spawning any more pods当任何节点 (VM) 的 memory 利用率达到 80% 时,我希望该节点停止生成更多 pod

  2. 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)。

Already gone through已经通过了

question It gives a way to achieve but there is no memory parameter involved. 问题它提供了一种实现方法,但没有涉及 memory 参数。

You need to scale in 2 levels.您需要扩展 2 个级别。

  1. 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 指标设置扩展策略。

  2. 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.

相关问题 如何获取 CPU 利用率,Memory kubernetes 中的命名空间,pod,服务的利用率? - How to get CPU Utilization ,Memory Utilization of namespaces,pods ,services in kubernetes? 限制每个节点的 Pod 数量 - Limit the number of pods per node 我们可以增加 Kubernetes 中每个节点的 pod 数量吗? - Can we increase number of pods per node in Kubernetes? 如何触发 EKS pod 的自动缩放? - How to trigger auto-scaling for EKS pods? K8s azure VM 节点 - 可以从主节点 ping 工作节点,但无法 ping 工作节点上的 pod - K8s azure VM nodes - can ping worker node from master node but cannot ping pod on worker node Kubernetes : GKE | 即使内存利用率大于/等于目标值,HPA 也不会扩展 Pod - Kubernetes : GKE | HPA is not scaling pods even though the memory utilization is greater/equal to target value 根据每个 Pod 的活动连接数扩展 GKE Pod - Scaling GKE pods based on number of active connections per pod 如何仅在工作节点上安排 gitlab-runner pod? - How to schedule gitlab-runner pods on worker nodes only? 如何根据 kubernetes 中的节点对 pod 进行排序 - How to order pods based on the nodes in kubernetes Prometheus 计算 Pod 的 memory 和 CPU 利用率 - Calculate the memory and CPU utilization for pods by Prometheus
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM