如何配置AWS集群Cluster Autoscaler仅基于CPU阈值缩容?
解决Cluster Autoscaler仅基于CPU利用率缩容的问题
要让Cluster Autoscaler只依据CPU利用率执行缩容操作,你需要在启动参数中添加--resource-ignore-list=memory,这个参数会让Autoscaler在评估节点是否可缩容时忽略内存利用率指标。
修改后的完整配置
- command: - ./cluster-autoscaler - --cloud-provider=aws - --namespace=kube-system - --node-group-auto-discovery=asg:tag=k8s.io/cluster-autoscaler/enabled,k8s.io/cluster-autoscaler/{my-cluster-name} - --logtostderr=true - --scale-down-utilization-threshold=0.4 - --resource-ignore-list=memory - --skip-nodes-with-local-storage=false - --skip-nodes-with-system-pods=false - --stderrthreshold=info - --v=4
说明
添加--resource-ignore-list=memory后,Cluster Autoscaler会完全忽略内存利用率的数值,仅以你设置的--scale-down-utilization-threshold=0.4作为CPU利用率的判断标准,当节点CPU利用率低于该阈值时,才会将其纳入缩容候选范围。
验证方法
更新Cluster Autoscaler的Deployment后,查看日志,你会发现不再出现类似memory utilization too big的节点移除拒绝信息,所有缩容判断都会仅基于CPU利用率进行。
内容的提问来源于stack exchange,提问作者yuofvi
相关产品推荐
相关产品推荐

