Cluster Autoscaler plays a vital role in a Kubernetes cluster by ensuring adequate computing resources are available by adding nodes to a cluster and keeping infrastructure costs down by removing nodes.
The Kubernetes Cluster Autoscaler automatically adjusts the number of nodes in your cluster when pods fail or are rescheduled onto other nodes. The Cluster Autoscaler uses Auto Scaling groups. For more information, see Cluster Autoscaler on AWS.
Step 2: Verify how many nodes and pods are running
Node :
Pods:
Step 3: Create a IAM OIDC Provider
IAM OIDC is used for authorizing the Cluster Autoscaler to launch or terminate instances under an Auto Scaling group. Open EKS Dashboard and copy a OpenID Connect Provider link
Open a IAM Providers
Click “Add provider,” select “OpenID Connect,” and click “Get thumbprint” as shown below:
Then enter the “Audience” (sts.amazonaws.com in our example pointing to the AWS STS, also known as the Security Token Service) and click the add provider.
Adding identity information on identity providers
Step 4: Create IAM Policy
Create a Policy with necessary permission.
To create the policy with the necessary permissions, save the below file as AmazonEKSClusterAutoscalerPolic
Review and create a policy
Step 5 : Create a IAM Role for the provider.
Create role
Select the web identity
Select identity provide and audience click next.
Add Policy AmazonEKSClusterAutoscalerPolicy
Click Next and provide Role Name : EKS_Autoscaler
verify the IAM role and make sure the policy is attached.
Edit the “Trust relationships.”
Before Edit “Trust relationships.”
After Edit “Trust relationships.”
Then click “Update Trust Policy” to save it.
Step 6 : Deploy a Cluster Autoscaler
Next, we deploy Cluster Autoscaler. To do so, you must use the Amazon Resource Names (ARN) number of the IAM role created in our earlier step.The content intended to save into a file (make sure you copy all of the content presented over the next page):
Modify below two lines
Line 8 : change IAM Role name
Line 159 :--node-group-auto-discovery = This is used by CA to discover the Auto Scaling group based on its tag.
To deploy CA, save the following content presented after the command below in a file and run this provided command:
Cluster Autoscaler plays a vital role in a Kubernetes cluster by ensuring adequate computing resources are available by adding the nodes to a cluster and keeping infrastructure costs down by removing nodes