--- title: "Cluster Autoscaler" type: concept tags: - Kubernetes - EKS - Autoscaling - Node - AWS - ASG sources: - ctp-topic-64-scaling-out-with-amazon-eks - ctp-topic-70-eks-deployment-using-iac last_updated: 2026-04-28 --- ## Definition Cluster Autoscaler 是 Kubernetes 官方的节点(Node)级别扩缩容组件,通过联动 AWS Auto Scaling Group(ASG)或托管节点组(Managed Node Group),根据集群内 Pending Pod 的数量和资源请求自动调整节点数量。 ## Key Mechanisms - **扩缩容决策依据**:集群内 Pending Pod 的数量(而非直接基于资源利用率) - **资源请求感知**:考虑 Pod 的 CPU/内存 requests,不仅仅是当前实际使用量 - **ASG/节点组联动**:更新 ASG 或托管节点组的期望容量(Desired Capacity) - **Auto-discovery 模式**:推荐使用,自动发现和管理 ASG - **Mixed Instances Policy**:支持在同一 ASG 中混合使用多种 EC2 实例类型 - **配置变更**:min/max 配置变更应在 ASG/托管节点组层面操作,而非直接修改 Cluster Autoscaler ## Relationship with Karpenter - **Cluster Autoscaler**:基于节点组间接扩缩容,响应相对较慢 - **Karpenter**:直接与 EC2 API 交互,响应更快速灵活,是 Cluster Autoscaler 的演进方案 ## Limitations - 依赖预配置的 ASG/节点组,灵活性受限 - 扩容速度受 ASG 启动新实例的速度限制 - 无法处理需要特殊实例类型的工作负载 ## Sources - [[ctp-topic-64-scaling-out-with-amazon-eks]] - [[ctp-topic-70-eks-deployment-using-iac]]