Spawning an AWS EKS cluster has never been easier and options are many: CloudFormation, Terraform or CDK. For the lazy, you can even use the great CLI utility eksctl from Weavework.
But once your cluster is set up, how to assure the number of nodes is scaling properly? In this post, we will setup a new cluster from scratch using CDK and take a look at the **Cluster Autoscaler **component
First you will need an AWS account. You can create a new account on the sign-in page or reuse an existing account. Be aware that:
EKS is not included in the AWS free tier, meaning you will be billed for the managed Kubernetes control plane.You can use t3.micro instances for free with limitations
Choosing the node instance type
For an EKS setup, you certainly don’t want to use these free t3.micro instances:
For example, a t3.micro instance supports up to 4 pods
(2 ENI * (2 IP — 1) + 2)
which is simply too limited. You can find the number of supported pod by instance type here.
To keep it simple and cheap, we will use t3.medium instances which supports up to 17 pods by node. They are not free but quite inexpensive.
By the way, if you want to bypass the pod networking limitation, you need to opt out the AWS CNI plugin and use another plugin, for example Calico.
Create an admin user
Operating infrastructure with CDK requires extensive rights. To keep it simple, create a new user and grant it the managed AdministratorAccess policy. In real life you may want to create a custom IAM policy tailored to your needs.
Install CDK
Follow through the official documentation for getting started with CDK.
#aws-eks #kubernetes #devops #sre #scaling #programming #aws-cdk #infrastructure