简体   繁体   English

cluster-autoscaler无法扩展kubernetes集群

[英]cluster-autoscaler doesn't scale up the kubernetes cluster

I create a k8s cluster by kops on aws , the node auto scaling group configuration like: 我创建k8s由簇kopsaws ,节点自动缩放组配置等:

metadata:
creationTimestamp: "2017-03-21T03:53:26Z"
name: nodes
spec:
  associatePublicIp: true
  image: kope.io/k8s-1.4-debian-jessie-amd64-hvm-ebs-2016-10-21
  machineType: t2.medium
  maxSize: 5
  minSize: 2
  role: Node
  zones:
  - us-west-1a
  - us-west-1c

the aws console shows current asg like: aws控制台显示当前的asg,例如:

desired:2; min:2; max:5

then I install the add-ons --- cluster-autoscaler by using the official doc , then I deploy a pod which current cluster can't supply the resource, but cluster-autoscaler doesn't add the node to the cluster, logs is like below: 然后我使用官方文档安装add-ons --- cluster-autoscaler ,然后部署一个Pod,当前集群无法提供资源,但是cluster-autoscaler不会将节点添加到集群中,日志是如下所示:

admin@ip-10-0-52-252:/var/log$kubectl logs -f cluster-autoscaler-1581749901-fqbzk -n kube-system
I0322 07:08:43.407683       1 event.go:216] Event(api.ObjectReference{Kind:"Pod", Namespace:"default", Name:"new-mq-test-951523717-trd2s", UID:"9437ac54-0ecd-11e7-8779-0257a5d4c012", APIVersion:"v1", ResourceVersion:"189546", FieldPath:""}): type: 'Normal' reason: 'NotTriggerScaleUp' pod didn't trigger scale-up (it wouldn't fit if a new node is added)
I0322 07:08:43.407910       1 event.go:216] Event(api.ObjectReference{Kind:"Pod", Namespace:"default", Name:"new-mq-test-951523717-n986l", UID:"9437a3db-0ecd-11e7-8779-0257a5d4c012", APIVersion:"v1", ResourceVersion:"189543", FieldPath:""}): type: 'Normal' reason: 'NotTriggerScaleUp' pod didn't trigger scale-up (it wouldn't fit if a new node is added)

so why the cluster-autoscaler doesn't scale up the cluster by adding the ec2 nodes ? 那么,为什么cluster-autoscaler无法通过添加ec2节点来扩展集群? any answers are very appreciated 任何答案都非常感谢

最终我找到了答案,我的默认nodes asg kops配置是t2.medium ,而我部署的Pod需要5000M的内存,因为我们都知道t2.medium内存是4GB ,无法满足要求,所以cluster-autoscaler无法扩展!

I faced a similar issue while trying to use Kubernetes autoscaling on Google Container Engine. 尝试在Google Container Engine上使用Kubernetes自动缩放时遇到了类似的问题。 This normally happens when your cluster doesn't contain enough nodes to accomodate anymore Kubernetes pod . 当您的集群中没有足够的节点来容纳Kubernetes pod时,通常会发生这种情况。

The solution to this is to enable autoscaling in your cluster (AWS EC2 in your case) along with kubernetes autoscaling. 解决方案是在群集中启用自动缩放(在您的情况下为AWS EC2)以及kubernetes自动缩放。

Checkout the following Kubernetes documentation for autoscaling on AWS for further information: link . 请查看以下Kubernetes文档以在AWS上自动缩放以获取更多信息: link

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM