DEV Community

Cover image for EKS Auto Mode Unlocked for Existing Clusters with Terraform

EKS Auto Mode Unlocked for Existing Clusters with Terraform

Jatin Mehrotra on December 13, 2024

In the previous blog, I explained that EKS Auto mode is now supported by terraform-eks-module and illustrated how we can create new cluster with E...
Collapse
 
deepak_b profile image
Deepak B

Thanks for the post Jatin, This is very helpful.

I have quick query on how do we create custom NodePool and Node Class for existing cluster as we have specific requirements from compute perspective.

Collapse
 
jatinmehrotra profile image
Jatin Mehrotra • Edited

THANK YOU @deepak_b. I am happy that it helped you.

Here is the documentation

docs.aws.amazon.com/eks/latest/use...
docs.aws.amazon.com/eks/latest/use...

Nodepool requires to have nodeclass in the cluster.

Let me know if you have any other questions would be happy to help and I am very curious to understand how you are using EKS auto for your needs and how it is helping you. Any challenges you are facing or you wish they have included some specific feature in EKS Auto? Please share your views.

Collapse
 
deepak_b profile image
Deepak B

Thanks Jatin.. was wondering on how can we add it to the terraform code for existing cluster so that when migrate our workload to Auto mode we make sure its using custom nodeclass and nodePool

Thread Thread
 
jatinmehrotra profile image
Jatin Mehrotra

@deepak_b Thank you for your question

how can we add it to the terraform code for existing cluster so that when migrate our workload to Auto mode we make sure its using custom nodeclass and nodePool

There is one consideration before you can add custom nodeClass and nodePool

  • nodeClass and nodePool are the concepts of karpenter. Having said that it also means the EKS Auto when enabled on EKS installs karpenter and CRD to support nodeClass and nodePool

  • This means first you need to enable EKS Auto mode on your cluster then using terraform install nodeClass and nodePool

  • nodeClass and nodePool essentially are yaml manifest which can be applied using terraform using kubectl_manifest resource

Note: In order to use this resource you need to connect respective kubectl provider and configure it so that it can connect to eks cluster

provider "kubectl" {
  host                   = var.eks_cluster_endpoint
  cluster_ca_certificate = base64decode(var.eks_cluster_ca)
  token                  = data.aws_eks_cluster_auth.main.token
  load_config_file       = false
}
Enter fullscreen mode Exit fullscreen mode

Hope it helps.

Thread Thread
 
deepak_b profile image
Deepak B

Thanks Jatin. This helps :)

Thread Thread
 
jatinmehrotra profile image
Jatin Mehrotra

I am also curious how you are trying to use EKS Auto for what kind of use case and why did you guys decided to move to EKS Auto? Please share it if you have time

Thread Thread
 
deepak_b profile image
Deepak B

Sure Jatin, We are currently in POC phase, were exploring Karpenter for node autoscaling and better optimisation of resources that's when AWS launched EKS AUTO, this makes it more convenient as now its all managed by AWS. It would be interesting run chaos engineering with this setup and find out how app responds to scaling requests and obvious time taken for scaling request to first request processed by new pod.

Thread Thread
 
jatinmehrotra profile image
Jatin Mehrotra

Sounds cool,Now it all makes sense.
I would be really interested to know how you are pilling the chaos engineering with this setup.

Just in case you can use AWS FIS for injecting fault into Kubernetes pods : docs.aws.amazon.com/fis/latest/use...

You can use the aws:eks:pod actions to inject faults into the Kubernetes Pods running in your EKS clusters.

Lets connect on Linkedin so that we can have more discussion on this linkedin.com/in/jatinmehrotra/

Thread Thread
 
deepak_b profile image
Deepak B

Yeah, we have been using FIS since ~2yrs now. Love, how its catching up with other leading tools.

Collapse
 
harik8 profile image
Hari Karthigasu

bootstrap_self_managed_addons = true saved my day :D, Thanks!

Collapse
 
jatinmehrotra profile image
Jatin Mehrotra

@harik8

I lost my few hairs for this :D Happy that it helped. Share it with Other EKS lovers or in your Linkedin Network if you think it can help others too