This repository consists example codes for Karpenter Cluster Autoscaler.
Karpenter is an Open Source Cluster Autoscaler tool developed and published by AWS.
├── README.md
├── karpenter
│ ├── amd64-deployment.yaml
│ ├── amd64-provisioner.yaml
│ ├── arm64-deployment.yaml
│ ├── arm64-provisioner.yaml
│ ├── spot-deployment.yaml
│ └── spot-provisioner.yaml
└── terraform-eks
├── eks.tf
├── iam.tf
├── karpenter.tf
├── outputs.tf
├── provider.tf
├── sg.tf
├── vars.tf
└── vpc.tf
In the Terraform folder, you can find the necessary configuration files for deploying a VPC, an EKS Cluster and Karpenter Helm Chart on top of that EKS cluster. Terraform configurations also creates the IAM Roles and Instance Profiles. You can change the configurations according to your needs.
In the Karpenter folder, you can find the Provisioner and Kubernetes Deployment yaml files.
- First, create the environment with Terraform.
terraform init
terraform plan
terraform apply
- You must update the
config_path
parameter in the Provider Configuration file for Helm provider's connection to the EKS cluster. - Then you need to create the Provisioners and Deployments.
- Finally you can scale the deployments using
kubectl scale deployment <deployment-name> --replicas=10
- You can set the log level of the Karpenter to DEBUG to see more information using
kubectl patch configmap config-logging -n karpenter --patch '{"data":{"loglevel.controller":"debug"}}
- You can see the logs of the Karpenter Controller using
kubectl logs -f -n karpenter $(kubectl get pods -n karpenter -l karpenter=controller -o name)
- First, you can delete the Deployments with
kubectl delete deployment <deployment-name>
- You can delete the Karpenter installation with
helm uninstall karpenter -n karpenter
- Finally, you can delete the whole environment with
terraform destroy
PS: Do not forget to delete Launch Templates created by Karpenter from your AWS Account.