Deploy Retail App on Amazon EKS Auto Mode with Terraform and ArgoCD

Deploy Retail App on Amazon EKS Auto Mode with Terraform and ArgoCD

Learn to deploy a retail microservices application on Amazon EKS Auto Mode using Terraform, Argo CD, GitOps, and Kubernetes Gateway API on AWS.

DevOps Engineer
Introduction
I wanted to revisit one of my earlier retail store deployments and try it with some of the newer capabilities available in Amazon EKS Auto Mode.

The application itself is a small microservices-based retail store, but getting all its components running involves quite a few things: setting up the network, creating the EKS cluster, deploying the services, and making the application accessible from outside the cluster.

For this deployment, I used Terraform, Amazon EKS Auto Mode, Argo CD, and Kubernetes Gateway API.

The retail application has five services:
  • UI - the web interface users interact with
  • Catalog - handles product information
  • Cart - manages shopping carts
  • Orders - handles orders
  • Checkout - handles the checkout process

I used Terraform to provision the VPC and EKS cluster. Instead of creating and maintaining worker node groups myself, I enabled EKS Auto Mode to manage compute provisioning. Argo CD takes care of deploying the application from Git, and Gateway API is used to expose the UI through an AWS-managed Application Load Balancer.

One thing I particularly wanted to explore was how these pieces work together without having to install and maintain a separate ingress controller.

I'll walk through the setup from the beginning, including the configuration that matters, the commands I used, a few things I noticed during deployment, and how to clean everything up afterwards.

By the end, you should have the retail application running on EKS, with all five services managed through Argo CD.


What is different about this setup?

If you've followed older EKS deployment guides, some of the steps here may look different.
The main changes in this setup are:
Component
Older approach
This deployment
Traffic routing
Install and manage ingress-nginx
Use the Gateway API integration available with EKS Auto Mode
Compute
Create and manage worker node groups
Enable EKS Auto Mode compute
Terraform EKS module
Older v20-style configuration
v21-style configuration
Application deployment
Manually deploy Helm charts or use a pipeline
Let Argo CD synchronize the charts from Git

The goal isn't to say that one approach replaces every other approach. I wanted to try the newer EKS Auto Mode workflow and understand what changes when AWS manages more of the infrastructure.

Here is how the tools cover that:
  • Terraform creates the VPC and the EKS cluster, and removes them again at the end.
  • EKS Auto Mode runs the nodes, so there are no node groups to manage.
  • Argo CD deploys the five Helm charts from Git. You could just run  helm install  five times, but Argo CD keeps comparing the cluster with Git and puts things back if someone changes them by hand.
  • Gateway API creates the load balancer. Auto Mode has it built in now, so there's no ingress controller to install.

architecture image/gif


Before you start

You'll need:
  • An AWS account with permissions to create VPCs, EKS clusters, IAM roles, and load balancers.
  • AWS CloudShell or another environment with AWS CLI, Git, and the required access configured.
  • Basic familiarity with Terraform and  kubectl .

I ran this deployment using AWS CloudShell in the ap-south-1 (Mumbai) region.
CloudShell didn't have Terraform installed in my environment, so I installed it under  /tmp . I also installed  kubectl  there.

Run:

mkdir -p /tmp/bin && export PATH=/tmp/bin:$PATH
cd /tmp
curl -sLO https://releases.hashicorp.com/terraform/1.9.8/terraform_1.9.8_linux_amd64.zip
unzip -oq terraform_1.9.8_linux_amd64.zip -d /tmp/bin
curl -sLO "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl && mv kubectl /tmp/bin/
export TF_DATA_DIR=/tmp/tfdata
terraform version


Next, clone the repository. It contains the Terraform configuration and Kubernetes manifests used throughout this guide.

git clone https://github.com/pooja-bhavani/retail-store-eks-auto-mode.git
cd retail-store-eks-auto-mode


Step 1: Create the VPC and the cluster

The Terraform is in  terraform/main.tf . You don't have to understand every line, but four settings are worth a look because the whole thing depends on them.

 compute_config  with  enabled = true  is what turns Auto Mode on. Without it you get a plain EKS cluster with no nodes. The two node pools listed are Auto Mode's built-in ones.
The two subnet tags,  kubernetes.io/role/elb  on the public subnets and  kubernetes.io/role/internal-elb  on the private ones, are how Auto Mode finds where to put load balancers. If they're missing, the load balancer has nowhere to go.

 enable_cluster_creator_admin_permissions  gives whoever runs  terraform apply  admin access inside the cluster. Leave it out and you've built a cluster you can't use with kubectl.

 single_nat_gateway = true  creates one NAT gateway for the private subnets, which is what lets the nodes pull images. You pay for a NAT gateway for every hour it exists, so one is the cheapest option. The downside is that if its Availability Zone goes down, nodes in the other zone lose outbound access. If you're going to depend on this cluster, set it to false and get one per zone.
Here's the whole file:

terraform/main.tf

# terraform/main.tf
data "aws_availability_zones" "available" {
filter {
name = "opt-in-status"
values = ["opt-in-not-required"]
}
}

locals {
azs = slice(data.aws_availability_zones.available.names, 0, 2)
vpc_cidr = "10.0.0.0/16"

tags = {
Project = var.cluster_name
Purpose = "eks-auto-mode-retail-store-demo"
}
}

module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 6.0"

name = var.cluster_name
cidr = local.vpc_cidr
azs = local.azs

private_subnets = [for i, _ in local.azs : cidrsubnet(local.vpc_cidr, 4, i)]
public_subnets = [for i, _ in local.azs : cidrsubnet(local.vpc_cidr, 8, i + 48)]

enable_nat_gateway = true
single_nat_gateway = true

public_subnet_tags = {
"kubernetes.io/role/elb" = 1
}
private_subnet_tags = {
"kubernetes.io/role/internal-elb" = 1
}

tags = local.tags
}

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 21.0"

name = var.cluster_name
kubernetes_version = var.kubernetes_version

endpoint_public_access = true
enable_cluster_creator_admin_permissions = true

compute_config = {
enabled = true
node_pools = ["general-purpose", "system"]
}

vpc_id = module.vpc.vpc_id
subnet_ids = module.vpc.private_subnets

tags = local.tags
}

The repo also has  versions.tf ,  variables.tf  and  outputs.tf . They set the provider versions, the region and cluster name, and print the kubeconfig command. You don't need to change them.

Pick a Kubernetes version

Don't just copy a version number from a blog post, including this one. Ask AWS what's in standard support right now:

aws eks describe-cluster-versions --region ap-south-1 \
--query 'clusterVersions[?status==`STANDARD_SUPPORT`].clusterVersion'

Then run it:

cd terraform

terraform init
terraform validate
terraform plan
terraform apply



Step 3: Connect to the cluster

Update your local  kubeconfig :

aws eks update-kubeconfig --region ap-south-1 --name retail-store
kubectl get nodes
kubectl get pods -A



Step 4: Gateway API isn't switched on by default, so turn it on:

Gateway API support is not active by default. You can enable it using the AWS CLI:

aws eks update-cluster-config \
--region ap-south-1 \
--name retail-store \
--kubernetes-network-config \
'{"elasticLoadBalancing":{"enabled":true,"gatewayApi":{"crds":{"managed":true}}}}'

Wait for the update to complete successfully before continuing. You can inspect its status using the update ID returned by the command:

aws eks describe-update \
--region ap-south-1 \
--name retail-store \
--update-id YOUR_UPDATE_ID \
--query 'update.status' \
--output text

Then verify:

kubectl get crd | grep -i gateway

kubectl api-resources \
--api-group=gateway.k8s.aws



Once the Gateway has an address, print the link to your store:

kubectl get gateway -n retail-store retail-gateway \
-o jsonpath='http://{.status.addresses[0].value}{"\n"}'

Copy the whole line it prints (it starts with  http:// ) and open it in your browser. If it prints only  http:// , the load balancer isn't ready yet, so wait a minute and run the command again. The store can also take a few more minutes after the address appears before it answers.

You should see the retail store home page:


Step 5: Improve your Argo CD installation

kubectl create namespace argocd

kubectl create namespace argocd

kubectl apply -n argocd \
--server-side \
--force-conflicts \
-f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

kubectl get pods -n argocd

kubectl get nodes



Step 6: Deploy the Microservices via GitOps

Each service is one Argo CD  Application  that points at a Helm chart in the repo. Here is the one for the catalog service:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: retail-store-catalog
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/<your-github-user>/<your-repo>
targetRevision: main
path: src/catalog/chart
helm:
valueFiles:
- values.yaml
destination:
server: https://kubernetes.default.svc
namespace: retail-store
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true

Now try writing the one for cart yourself. The chart is in  src/cart/chart . Decide which fields need to change before you read on.

Only two do:  metadata.name  becomes  retail-store-cart  and  path  becomes  src/cart/chart . The name matters more than it looks. Argo CD uses it as the Helm release name, and the ui chart finds the other services using names built from it, like  retail-store-catalog  and  retail-store-orders . Name it something else and the ui can't find them. . 

The ui needs two extra settings. Its chart creates two nginx Ingresses and a cert-manager ClusterIssuer by default. This cluster has neither nginx nor cert-manager, so the Ingresses never get an address and Argo CD shows the app as Progressing forever. Switch them off in the ui Application:

helm:
valueFiles:
- values.yaml
valuesObject:
ingresses: []
parameters:
- name: certManager.createClusterIssuer
value: "false"

 k8s/argocd-apps.yaml  in the repo has all five. Apply it and wait for them to settle:

kubectl apply -f k8s/argocd-apps.yaml
kubectl get applications -n argocd -w
kubectl get pods -n retail-store




Step 7: Expose the Application Using Gateway API

apiVersion: gateway.k8s.aws/v1
kind: LoadBalancerConfiguration
metadata:
name: internet-facing
namespace: retail-store
spec:
scheme: TODO
---
apiVersion: gateway.k8s.aws/v1
kind: TargetGroupConfiguration
metadata:
name: retail-store-ui
namespace: retail-store
spec:
targetReference:
name: retail-store-ui
defaultConfiguration:
targetType: TODO

With Gateway API built in there's no controller to install. You only write the resources. Two Auto Mode defaults trip people up here, so I'd like you to write part of this yourself.

The first is the load balancer scheme. It's  internal  by default, which means nobody outside your VPC can reach it. The second is the target type. AWS's docs say it's inferred as  instance  by default, which needs a NodePort, and the ui is a plain ClusterIP service, so it needs to be  ip .

The GatewayClass hands the work to Auto Mode's ALB controller. The Gateway picks up your  internet-facing  settings through  parametersRef , and the HTTPRoute sends everything at  /  to the ui service on port 80.

apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: eks-auto-alb
spec:
controllerName: eks.amazonaws.com/gateway-alb
---
apiVersion: gateway.k8s.aws/v1
kind: LoadBalancerConfiguration
metadata:
name: internet-facing
namespace: retail-store
spec:
scheme: internet-facing
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: retail-gateway
namespace: retail-store
spec:
gatewayClassName: eks-auto-alb
infrastructure:
parametersRef:
group: gateway.k8s.aws
kind: LoadBalancerConfiguration
name: internet-facing
listeners:
- name: http
protocol: HTTP
port: 80
---
apiVersion: gateway.k8s.aws/v1
kind: TargetGroupConfiguration
metadata:
name: retail-store-ui
namespace: retail-store
spec:
targetReference:
name: retail-store-ui
defaultConfiguration:
targetType: ip
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: retail-store-ui
namespace: retail-store
spec:
parentRefs:
- name: retail-gateway
sectionName: http
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: retail-store-ui
port: 80

Apply the GatewayClass first, give it a few seconds, then apply the whole file:

sed -n '1,6p' k8s/gateway.yaml | kubectl apply -f -
sleep 20
kubectl apply -f k8s/gateway.yaml
kubectl wait --for=condition=Programmed gateway/retail-gateway -n retail-store --timeout=600s
kubectl get gateway -n retail-store retail-gateway -o jsonpath='{.status.addresses[0].value}'; echo



The Gateway got an address in about a minute and a half, but  PROGRAMMED  stayed  Unknown  for a little longer. The event said  Monitoring provisioning state , which sounds like an error but just means AWS is still building the load balancer. After roughly four minutes in total the retail store opened in the browser.



Step 8: Fix how you access the Argo CD dashboard

You can verify the deployment using  kubectl , but the Argo CD dashboard makes it easier to inspect the application resource tree and check deployment health.

Because the dashboard provides administrative access, I recommend using port-forwarding for normal access. This avoids exposing the Argo CD server through a public load balancer.

Option 1: Access the dashboard locally (recommended)

Run:

kubectl port-forward svc/argocd-server -n argocd 8080:443

Keep that terminal running and open:

https://localhost:8080

Option 2:

We'll expose it with a Network Load Balancer. The setting that matters is  loadBalancerClass: eks.amazonaws.com/nlb . Without it Kubernetes quietly creates a Classic Load Balancer and ignores the NLB annotations. You also can't add the class to a Service that's already type LoadBalancer, so switch it back to ClusterIP first:

kubectl patch svc argocd-server -n argocd \
-p '{"spec":{"type":"ClusterIP","loadBalancerSourceRanges":null}}'
sleep 30
kubectl annotate svc argocd-server -n argocd \
service.beta.kubernetes.io/aws-load-balancer-scheme=internet-facing \
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type=ip --overwrite
kubectl patch svc argocd-server -n argocd \
-p '{"spec":{"type":"LoadBalancer","loadBalancerClass":"eks.amazonaws.com/nlb","loadBalancerSourceRanges":["<YOUR_PUBLIC_IP>/32"]}}'

Put your own public IP in place of  <YOUR_PUBLIC_IP> 




Retrieve the initial admin password:

kubectl -n argocd get secret argocd-initial-admin-secret \
-o jsonpath='{.data.password}' | base64 -d; echo

After logging in, check that all five applications show  Healthy  and  Synced .





Clean up

Delete the Kubernetes resources first, so the load balancers are gone before Terraform tries to remove the VPC:

kubectl delete -f k8s/gateway.yaml
kubectl delete namespace argocd
kubectl delete namespace retail-store
sleep 180
aws elbv2 describe-load-balancers --region ap-south-1 --query 'LoadBalancers[].LoadBalancerName'
aws elb describe-load-balancers --region ap-south-1 --query 'LoadBalancerDescriptions[].LoadBalancerName'
cd terraform && terraform init && terraform destroy

Both of the load balancer commands should print an empty list before you run  terraform destroy . When it finishes, have a quick look in the EC2, VPC and Elastic IP consoles for anything left behind.

Code: All the files from this guide are in  retail-store-eks-auto-mode 

Sample Application:  aws-containers/retail-store-sample-app   Older version: The earlier setup with ingress-nginx and GitHub Actions is this repo

Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article