Saturday, December 24, 2022

Commands to Configure Karpenter on AWS EKS

Karpenter is the future of cluster autoscaling in Kubernetes. AWS EKS natively supports Karpenter and now its tightly integrated with AWS EKS in various configurations including fargate or managed nodegroups etc. 

Following are few of the commands to be used to install and configure Karpenter on AWS EKS. For full set of instructions, refer here:

export KARPENTER_VERSION=v0.20.0

export CLUSTER_NAME="karpenter-test"

export AWS_DEFAULT_REGION="ap-southeast-2"

export AWS_ACCOUNT_ID="$(aws sts get-caller-identity --query Account --output text)"

export KARPENTER_IAM_ROLE_ARN="arn:aws:iam::${AWS_ACCOUNT_ID}:role/${CLUSTER_NAME}-karpenter"

export CLUSTER_ENDPOINT="$(aws eks describe-cluster --name ${CLUSTER_NAME} --query "cluster.endpoint" --output text)"


aws eks update-kubeconfig --region ${AWS_DEFAULT_REGION}  --name ${CLUSTER_NAME}

aws eks update-kubeconfig --name mycluster 

diff ~/.kube/config ~/.kube/config-backup

mv ~/.kube/config.bk ~/.kube/config

helm upgrade --install karpenter oci:// --version ${KARPENTER_VERSION} --namespace karpenter --create-namespace \

  --set serviceAccount.annotations."eks\.amazonaws\.com/role-arn"=${KARPENTER_IAM_ROLE_ARN} \

  --set${CLUSTER_NAME} \


  --set${CLUSTER_NAME} \

  --set${CLUSTER_NAME} \


No comments: