EKS Cluster Autoscaler basically handles both master and worker nodes in Amazon's Elastic Kubernetes Service (EKS). It uses EKS for master node stuff and the Cluster Autoscaler to adjust worker nodes based on how busy things get. Easy peasy!
Use CloudFormation to create a secure VPC environment.
Make an IAM role with the "AmazonEKSCluster" policy for EKS management.
- Execute the creation of an EKS cluster, specifying:
- The previously created EKS role.
- The VPC established through the CloudFormation.
- Public and private cluster endpoint access settings.
- Default selection of pods to be added to the cluster.
Configure the node group with:
- The VPC created earlier.
- A role with policies (EC2ContainerRegistry, EKS_CNI, EKSWorkerNode, IAM-Policy_for_AutoScaler).
Use Cloud Shell to configure kubectl for EKS interaction.:
aws eks update-kubeconfig --name <cluster_name>
Run the cluster-AutoScaler.yaml file to get your autoscaler going.
Use the command below to edit the Cluster Autoscaler deployment and customize parameters such as cluster name and Kubernetes version:
kubectl edit deployment -n kube-system cluster-autoscaler
Make sure everything's running smoothly by checking pod status and logs:
kubectl get pod -n kube-system
kubectl logs -n kube-system POD_NAME
Deploy a sample Nginx app for testing by rununng the nginx.yaml #Then Access the application through the LoadBalancer DNS in web browser.
Play around with Nginx replicas to see autoscaling behavior.