This repo contains a terraform code that allows you to bootstrap EKS cluster and Karpenter installation.
Some of the code is commented out because terraform cant have dependencies for resources/providers that are not exist (in the moment of apply). So please follow next steps.
- First we want to bootstrap the EKS cluster and karpenter nodegroup, where Karpenter controller workload will be located. To do so:
terraform init
terraform apply
-
Uncomment code in
karpenter.tf
andprovider.tf
-
Deploy Karpenter controller helm chart and create karpenter node pools doing again:
terraform init
terraform apply
After that we will be having Karpenter node pool for all the workload we would need.
Karpenter uses very good cost-effective algorithm to bootstrap required instance(s).
We can require specific architecture for our workload by using affinity/nodeSelector in k8s manifest files or helm values:
arm64
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- arm64
or
nodeSelector:
kubernetes.io/arch: 'arm64'
amd64
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
or
nodeSelector:
kubernetes.io/arch: 'amd64'