Repo for Cluster Autoscaler vs Karpenter Blog at Kapstan
brew install awscli
https://docs.aws.amazon.com/cli/latest/reference/configure/index.html
brew install terraform
brew install kubernetes-cli
brew tap aws/tap
brew install eks-node-viewer
The following commands assume you are in eks-compute-autoscaling directory
- Add the access_key and secret_key to infrastructure/terraform.auto.tfvars
access_key = "Your AWS account Access Key"
secret_key = "You AWS account Secret Key"
- Create the infrastructure
cd infrastructure
terraform init
terraform plan
terraform apply
- Get the output from infrastructure
cd infrastructure
terraform output -json
- Add the required output vaules in karpenter/terraform.auto.tfvars
cluster_name = "autoscaler-demo"
region = "us-west-2"
cluster_certificate_authority_data = ""
cluster_endpoint = ""
karpenter_instance_profile_name = ""
karpenter_irsa_arn = ""
karpenter_role_arn = ""
eks_managed_node_group_id = ""
- Add Karpenter to the cluster
cd karpenter
terraform init
terraform plan
terraform apply
- View the provisioned nodes by default
eks-node-viewer --resources cpu,memory
- Add the required vaules in karpenter/terraform.auto.tfvars
cluster_name = "autoscaler-demo"
cluster_certificate_authority_data = ""
cluster_endpoint = ""
- Deploy nginx pods to scale up the nodes
cd nginx
terraform init
terraform plan
terraform apply
- View Nodes
eks-node-viewer --resources cpu,memory
- Output (Might change based on what node Karpenter chooses to provision)
- Remove nginx pods to scale down the nodes
terraform destroy
cd karpenter
terraform destroy
- Please make sure to remove Karpenter before adding Cluster Autoscaler in order to view the differnce between the autoscaling capabilities of both.
- Get the output from infrastructure
cd infrastructure
terraform output -json
- Add the required vaules in cluster-autoscaler/terraform.auto.tfvars
cluster_autoscaler_irsa_arn = ""
cluster_autoscaler_irsa_name = "cluster-autoscaler"
cluster_certificate_authority_data = ""
cluster_endpoint = ""
cluster_name = "autoscaler-demo"
region = "us-west-2"
- Deploy Cluster Autoscaler to the cluster
cd cluster-autoscaler
terraform init
terraform plan
terraform apply
-
Add Nginx Deployment to test autoscaling
-
View Nodes
eks-node-viewer --resources cpu,memory
- Output
cd infrastructure
terraform destroy --auto-approve