【问题标题】:cluster-autoscaler doesn't scale up the kubernetes clustercluster-autoscaler 不会扩展 kubernetes 集群
【发布时间】:2017-03-22 07:35:21
【问题描述】:

我通过kopsaws上创建了一个k8s集群,节点自动伸缩组配置如下:

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

aws 控制台显示当前 asg 如下:

desired:2; min:2; max:5

然后我使用official doc 安装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)

那么为什么cluster-autoscaler 不通过添加 ec2 节点来扩展集群?任何答案都非常感谢

【问题讨论】:

    标签: amazon-web-services kubernetes


    【解决方案1】:

    我终于找到了答案,我的默认kops 配置nodes asg 是t2.medium,而我部署的pod 需要5000M 用于内存,因为我们都知道t2.medium 内存是@987654326 @ 不符合要求,所以 cluster-autoscaler 无法放大!

    【讨论】:

      【解决方案2】:

      我在尝试在 Google Container Engine 上使用 Kubernetes 自动缩放时遇到了类似的问题。当您的集群没有足够的节点来容纳 Kubernetes pod 时,通常会发生这种情况。

      解决方案是在您的集群(在您的情况下为 AWS EC2)中启用自动扩展以及 kubernetes 自动扩展。

      查看以下 Kubernetes 文档以了解 AWS 上的自动缩放功能:link

      【讨论】:

      • 我使用cluster_autoscaler add-on 来扩展集群,这意味着我不想手动更改集群。
      猜你喜欢
      • 2019-08-04
      • 1970-01-01
      • 2019-12-02
      • 2021-01-13
      • 2020-09-27
      • 1970-01-01
      • 2018-04-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多