k8s autoscaler 不工作,没有太多文档可读

k8s autoscaler not working, not much document to read

我正在尝试设置 k8s 自动缩放器,我经历了:https://hub.helm.sh/charts/stable/cluster-autoscaler 并做了很多实验但无法使其工作。我有两个选择,但都不起作用:

  1. 在master上部署autoscaler,我试过了:helm install my-release stable/cluster-autoscaler --set autoDiscovery.clusterName=hide-cluster,rbac.serviceAccount.name=default,tolerations[0].effect=NoSchedule,tolerations[0].operator="Equal",tolerations[0].value=/"true/",tolerations[0].key=node-role.kubernetes.io/master 但它总是说字段 tolerations[0].value=/"true/" 不符合预期,我尝试了几个我能想到的可能版本,比如使用 'true'、"true"、true 等 none有效。
  2. 部署在非主节点上:在这种情况下它要求网络插件...我认为只有主节点有网络插件。

关于如何在不使用 kops 或 EKS 的情况下设置自动缩放器的文档非常非常有限。我还想知道我们市场上有多少自动缩放器解决方案?好像autoscaler的网上学习资源不多

编辑:我终于按照本指南制作了自动缩放器 运行:https://docs.aws.amazon.com/eks/latest/userguide/cluster-autoscaler.html

但不包括ASG创建到节点的EC2实例。我检查了日志,它说 ASG 已经找到并注册,没有错误或其他提示我可以找到为什么没有节点出现在 kubectl get nodes

尝试将这些实例附加到 ASG - 遵循本教程:attaching-instances-asg

您还必须记住,要附加的实例必须满足特定条件:

  • 实例的状态是 running

  • 用于启动实例的 AMI 仍然存在。

  • 该实例不是不同 ASG 的成员

  • 实例启动到您的 ASG

  • 中定义的可用区之一

If the Auto Scaling group has an attached load balancer, the instance and the load balancer must both be in EC2-Classic or the same VPC. If the Auto Scaling group has an attached target group, the instance and the load balancer must both be in the same VPC.

看起来自动缩放器不适用于独立的 k8s,但必须在 EKS 或 Kops 之上使用,尽管我不确定。可用资源真的太有限了。