Search code examples
kubernetesamazon-ekseksctl

How to deploy EKS Cluster-Autoscaler with more than one autoscaling group


I'm following the instructions on https://eksworkshop.com/beginner/080_scaling/deploy_ca/ to deploy the cluster-autoscaler.

While following the instructions i notice that the cluster_autoscaler.yml file contains only one nodegroup to scale:

command:
  - ./cluster-autoscaler
  - --v=4
  - --stderrthreshold=info
  - --cloud-provider=aws
  - --skip-nodes-with-local-storage=false
  - --nodes=2:8:eksctl-eksworkshop-eksctl-nodegroup-0-NodeGroup-SQG8QDVSR73G
env:
  - name: AWS_REGION
    value: us-east-1

This leads me to believe that only that autoscaling group in aws will be scaled out when more pods need to be scheduled.

The reason I need to add two autoscaling groups is that one of the groups has OnDemand pricing and the other has Spot pricing and one of my deployments will schedule pods in the OnDemand autoscaling group while the other will schedule pods in the Spot autoscaling group.

Can I add two nodegroups in the - --nodes section of the file or is there some other way of doing what I'm asking?


Solution

  • You can just add another line with a second nodegroup, e.g.

    command:
      - ./cluster-autoscaler
      - --v=4
      - --stderrthreshold=info
      - --cloud-provider=aws
      - --skip-nodes-with-local-storage=false
      - --nodes=2:8:eksctl-eksworkshop-eksctl-nodegroup-0-NodeGroup-SQG8QDVSR73G
      - --nodes=2:8:NodeGroup2
    

    See this example here.