This workshop has been deprecated and archived. The new Amazon EKS Workshop is now available at www.eksworkshop.com.
In this section we will install Karpenter and learn how to configure a default Provisioner CRD to set the configuration. Karpenter is installed in clusters with a helm chart. Karpenter follows best practices for kubernetes controllers for its configuration. Karpenter uses Custom Resource Definition(CRD) to declare its configuration. Custom Resources are extensions of the Kubernetes API. One of the premises of Kubernetes is the declarative aspect of its APIs. Karpenter simplifies its configuration by adhering to that principle.
Install the chart passing in the cluster details and the Karpenter role ARN.
export CLUSTER_ENDPOINT="$(aws eks describe-cluster --name ${CLUSTER_NAME} --query "cluster.endpoint" --output text)"
helm upgrade --install --namespace karpenter --create-namespace \
karpenter oci://public.ecr.aws/karpenter/karpenter \
--version ${KARPENTER_VERSION} \
--set serviceAccount.annotations."eks\.amazonaws\.com/role-arn"=${KARPENTER_IAM_ROLE_ARN} \
--set settings.aws.clusterName=${CLUSTER_NAME} \
--set settings.aws.clusterEndpoint=${CLUSTER_ENDPOINT} \
--set defaultProvisioner.create=false \
--set settings.aws.defaultInstanceProfile=KarpenterNodeInstanceProfile-${CLUSTER_NAME} \
--set settings.aws.interruptionQueueName=${CLUSTER_NAME} \
--wait
The command above:
uses the CLUSTER_NAME so that Karpenter controller can contact the Cluster API Server.
Karpenter configuration is provided through a Custom Resource Definition. We will be learning about providers in the next section, the --wait
notifies the webhook controller to wait until the Provisioner CRD has been deployed.
To check Karpenter is running you can check the Pods, Deployment and Service are Running.
kubectl get all -n karpenter
To check the deployment. There should be one deployment karpenter
kubectl get deployment -n karpenter
To check running pods run the command below. There should be at least two pods.
kubectl get pods --namespace karpenter
You can increase the number of Karpenter replicas in the deployment for resilience. Karpenter will elect a leader controller that is in charge of running operations.