Finally…EKS Auto Mode is here…
We have Auto Pilot mode for cars and planes so why not for Amazon EKS !
AWS Announced the EKS Auto Mode in AWS : reInvent 2024 on Dec 1st
As the name suggests it looks like AWS services have taken more responsibility in managing the infrastructure so that you can focus on your application logic. AWS Philosophy remains same from Day 1…
This post is my first hand experience with EKS Auto Mode.
Creating an EKS Cluster
This also prompted me to look at the way I have created EKS Cluster earlier.
Step — Login to Cloud Shell
I am going to use CloudShell and use eksctl to create the EKS Cluster.
The eksctl version is already installed in the CloudShell. The prerequisite for this is to have version >= 0.195.0 . The version which I am using is 0.199.0
If you need to get eksctl refer the instructions on how to get those from the following post
Step — Create Cluster in Auto Mode
eksctl create cluster — name=test-auto-cluster — enable-auto-mode
Note the use of — enable-auto-mode flag
This has created the cluster in the EKS.
If you check the nodepool and nodes you will notice that there are no NODES running in your cluster . This has just created a Control Plane and no data plane nodes are there.
kubectl get nodepools
Kubectl get nodes
As you would notice there are no Nodes running.
Step — Deploy Sample Workload
When we deploy a sample workload in EKS it will detect that there are no Nodes running and it should create new nodes to accommodate the workload.
Create a deployment manifest (inflate.yaml)
# inflate.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: inflate
spec:
replicas: 1
selector:
matchLabels:
app: inflate
template:
metadata:
labels:
app: inflate
spec:
terminationGracePeriodSeconds: 0
nodeSelector:
eks.amazonaws.com/compute-type: auto
securityContext:
runAsUser: 1000
runAsGroup: 3000
fsGroup: 2000
containers:
- name: inflate
image: public.ecr.aws/eks-distro/kubernetes/pause:3.7
resources:
requests:
cpu: 1
securityContext:
allowPrivilegeEscalation: false
kubectl get events -w — sort-by ‘.lastTimestamp’
You would see the events such as
- RegisteredNode — node/i-0axxx-6560 — Node i-xxx06560 event : Registered Node i-xxx06560 in Controller
- Pulling image
- Created container inflate
- Stared container inflate
kubectl get nodes
This is the same node ending with i-xxx6560 and is now part of the general-purpose nodepool.
The same can be seen in the AWS Console as shown below.
Thus EKS automode
- Detected that there are no nodes running to accommodate the workload
- Created a single node to accommodate the workload
- Scheduled container on that node !
Step — Delete the Deployment
Let us delete the deployment to see the behaviour
kubectl delete -f inflate.yaml
Once again watch the kubernetes events
After some time let us say 30 seconds the node is gone. This is again automatically decided by EKS Auto mode as there is no requirement to have any workload running so No nodes should be running !
This is quite nice — AWSome !
Step — Try with another sample workload (optional)
I have also tried another deployment and it worked smoothly as well!
kubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml
The sample deployment file is as below.
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
This creates three nginx pods in the EKS cluster.
Step- Delete the deployment (optiona)
kubectl delete -f nginx-deployment.yaml
In the default configuration, EKS Auto Mode detects nodes that have been empty for thirty seconds, and terminates them.
Step — Delete the EKS Cluster
eksctl delete cluster — name test-auto-cluster
Summary
- EKS Auto Mode enables you to work with workload without worrying about the underlying infrastructure needs
- EKS automatically detects that there is a need to create a node and it is ready to service.
- When there is no workload it automatically deletes the node.
- EKS Auto Node should eventually save the AWS running costs. I have seen EKS cluster nodes running for a few days or few weeks even though no one is really using it even in DEV environment so this is just a boon in that scenario
- EKS Automode is certainly going to reduce the administrative overhead when it comes to capacity planning ,You could simply scale your pods based on traffic pattern without worrying about underlying compute thus optimising cost dynamically
- EKS auto mode also manages storage , networking , load balancing and core add ons for us and even takes care of patching (something for other posts)
- It is also possible to switch to auto-mode for existing EKS Cluster
Looking forward to exploring other features of EKS auto Mode in coming new year !
Wishing you Happy New Year 2025 ahead !