Configure Cluster Autoscaler (CA)

We will start by deploying Cluster Autoscaler. Cluster Autoscaler for AWS provides integration with Auto Scaling groups. It enables users to choose from four different options of deployment:

  • One Auto Scaling group
  • Multiple Auto Scaling groups
  • Auto-Discovery - This is what we will use
  • Master Node setup

In this workshop we will configure Cluster Autoscaler to scale using Cluster Autoscaler Auto-Discovery functionality. When configured in Auto-Discovery mode on AWS, Cluster Autoscaler will look for Auto Scaling groups that match a set of pre-set AWS tags. As a convention we use the tags :, and .

This will select the two Auto Scaling groups that have been created for Spot Instances.

The following link should take you to the Auto Scaling groups console. Type ‘eks’ in the search bar to see managed node groups we created previously . Verify the tags, and are present in all managed node groups. These tags were automatically added by EKS upon the creation of managed node groups.

We have provided a manifest file to deploy the CA. Copy the commands below into your Cloud9 Terminal.

mkdir -p ~/environment/cluster-autoscaler
curl -o ~/environment/cluster-autoscaler/cluster_autoscaler.yml
sed -i "s/--AWS_REGION--/${AWS_REGION}/g" ~/environment/cluster-autoscaler/cluster_autoscaler.yml

Deploy the Cluster Autoscaler

You are encouraged to look at the configuration that you downloaded for cluster autoscaler in the directory cluster-autoscaler and find out about some of the parameter we are passing to it. The full list of parameters can be found in Cluster Autoscaler documentation.

Cluster Autoscaler gets deployed like any other pod. In this case we will use the kube-system namespace, similar to what we do with other management pods.

kubectl apply -f ~/environment/cluster-autoscaler/cluster_autoscaler.yml

To watch Cluster Autoscaler logs we can use the following command:

kubectl logs -f deployment/cluster-autoscaler -n kube-system --tail=10

We are now ready to scale our cluster !!