karpenter-terraform
karpenter-terraform copied to clipboard
Terraform module and installation script for Karpenter
Provisioning Karpenter using Terraform
Introduction
Provisioning Karpenter requires a number of manual steps. This repository aims to automate those steps using Terraform
Prerequisites
You should have the following installed in your machine:
(Optional) Create Cluster
If you don't already have a cluster, adjust the cluster definition file and create one. Else, skip this step.
eksctl create cluster -f cluster/eks-cluster.yaml
Deploy Karpenter
All the related terraform templates are available in the karpenter
folder. It contains karpenter provisioner, Bottlerocket launch template and IAM roles, polcies needed for Karpenter.
Adjust variables in terraform.tfvars and deploy
cd karpenter
terraform init
terraform apply
Deploy the default Provisioner
manifest file that is created automatically
kubectl apply -f default-provisioner.yaml
Test with sample application
kubectl apply -f sample-workload/pause.yaml
Cleanup
To delete the Karpenter, use the following command
terraform destroy
To delete the whole cluster use the following command
eksctl delete cluster --region=ap-southeast-1 --name=eks-cluster
If you face any issues in cleaning up the resource, check the CloudFormation dashboard in the AWS console or delete the appropriate stack from there