Configure Kubernetes Gateway API in EKS Auto Mode

EKS Auto Mode simplifies cluster management by automatically handling node provisioning, scaling, and networking. This guide walks you through configuring the Kubernetes Gateway API (a Kubernetes API for defining traffic routing, TLS termination, etc.) on an EKS Auto Mode cluster. We’ll use the Envoy Gateway controller as the implementation.

Prerequisites

  1. AWS Account with appropriate permissions (IAM user/role with AdministratorAccess or equivalent).
  2. AWS CLI configured (aws configure).
  3. **eksctl` installed (v0.160.0+).
  4. **kubectl` installed.
  5. **Helm` installed (v3.12.0+).
  6. Basic knowledge of Kubernetes and AWS networking.

Step 1: Create an EKS Auto Mode Cluster

Use eksctl to create a cluster in Auto Mode. This automatically sets up managed node groups, VPC, and control plane.

`bash

Create a cluster in us-east-1 with Auto Mode enabled

eksctl create cluster \
--name=eks-autogw-cluster \
--region=us-east-1 \
--auto-mode-enabled \
--kubernetes-version=1.28 \
--nodegroup-name=auto-ng \
--node-type=t3.medium \
--nodes=2 \
--nodes-min=1 \
--nodes-max=3 \
--managed
`

Notes:

  • --auto-mode-enabled: Enables EKS Auto Mode (automatically manages nodes and scaling).
  • --kubernetes-version: Use v1.28+ (Gateway API requires v1.25+; v1.28 is recommended).

Wait ~10–15 minutes for the cluster to initialize.

Step 2: Update kubeconfig

Ensure kubectl connects to your new cluster:

bash
aws eks update-kubeconfig --name eks-autogw-cluster --region us-east-1
kubectl config use-context arn:aws:eks:us-east-1:<ACCOUNT_ID>:cluster/eks-autogw-cluster

Verify the cluster:
bash
kubectl cluster-info

Step 3: Install Gateway API CRDs

The Gateway API defines custom resources (e.g., Gateway, HTTPRoute). Install the CRDs first:

`bash

Apply official Gateway API CRDs (stable v1.0.0)

kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.0.0/gateway-api-crds.yaml
`

Verify CRDs:
`bash
kubectl get crd | grep gateway

Expected output: gateways.gateway.net, httproutes.gateway.net, etc.

`

Step 4: Install the Envoy Gateway Controller

We’ll use Envoy Gateway (a popular, community-maintained controller). Use Helm for installation.

4.1 Add Envoy Gateway Helm Repository

bash
helm repo add envoy-gateway https://envoy-gateway.github.io/gateway-api
helm repo update

4.2 Install Envoy Gateway

bash
helm install envoy-gateway envoy-gateway/gateway-api \
--namespace=gateway-system \
--create-namespace \
--set args="{--leader-election-namespace=gateway-system}"

Key Settings:

  • --namespace=gateway-system: Deploys resources in a dedicated namespace.
  • --set args="{--leader-election-namespace=gateway-system}": Enables high availability.

Wait for pods to be Ready:
`bash
kubectl get pods -n gateway-system

EXPECT: envoy-gateway-system envoy-gateway 1/1 Running

`

Step 5: Verify Gateway API Functionality

Deploy a simple Gateway and HTTPRoute to test end-to-end traffic routing.

5.1 Deploy a Sample Application

`bash

Deploy a test service (echo server)

kubectl create namespace test-app
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/main/examples/standard/httpbin.yaml -n test-app
`

5.2 Define a Gateway

`yaml

gateway.yaml

apiVersion: gateway.net/v1
kind: Gateway
metadata:
name: example-gateway
namespace: test-app
spec:
gatewayClassName: envoy-gateway
addresses:
- type: LoadBalancer
value: "example-gateway-lb"
listeners:
- hostname: "*"
port: 80
protocol: HTTP
`

Apply it:
bash
kubectl apply -f gateway.yaml -n test-app

5.3 Define an HTTPRoute

`yaml

httproute.yaml

apiVersion: gateway.net/v1
kind: HTTPRoute
metadata:
name: httpbin-route
namespace: test-app
spec:
parentRefs:
- name: example-gateway
hostnames:
- ")*
rules:
- backendRefs:
- name: httpbin
port: 80
matches:
- path:
type: PathPrefix
value: "/get"
`

Apply it:
bash
kubectl apply -f httproute.yaml -n test-app

5.4 Retrieve the LoadBalancer DNS

`bash
kubectl get gateway example-gateway -n test-app -o yaml | grep 'addresses'

Output will include a DNS name like: example-gateway-lb-.us-east-1.elb.amazonaws.com

`

Test the endpoint:
`bash
LB_DNS=$(kubectl get gateway example-gateway -n test-app -o jsonpath='{.status.addresses[0].value}')
curl http://$LB_DNS/get

Expected: JSON response from httpbin showing a GET request

`

Step 6: (Optional) Configure TLS & Advanced Routing

Extend the configuration with:

  • TLS Certificates: Use Certificate resources (e.g., via AWS Certificate Manager).
  • Middlewares: Add authentication, rate limiting, or headers using HTTPRoute filters.
  • Multi-Cluster Meshes: Use GatewayClass to connect to other clusters.

Key EKS Auto Mode Considerations

  1. IAM Permissions:

    • Ensure the Node IAM Role has AmazonEKSWorkerNodePolicy, AmazonEC2ContainerRegistryReadOnly, and AmazonEKS_CNI_Policy.
    • The Envoy Gateway controller needs permissions to manage NLBs/ALBs. Attach the AmazonEKSLoadBalancerControllerPolicy managed policy to the IAM role used by Envoy Gateway (or use IRSA).
  2. Load Balancer Type:

    • By default, Gateway API in EKS creates Network Load Balancers (NLB). To use Application Load Balancers (ALB), deploy the AWS Load Balancer Controller and configure Gateway with serviceType: LoadBalancer and annotations.
  3. Auto Scaling:

    • EKS Auto Mode automatically scales nodes. Ensure your Gateway controller replicas are set appropriately (e.g., replicas: 2 in Envoy Gateway Helm values for HA).

Troubleshooting Tips

  • Check Controller Logs: bash kubectl logs -n gateway-system deployment/envoy-gateway -f
  • Gateway Status: bash kubectl describe gateway example-gateway -n test-app
  • HTTPRoute Status: bash kubectl describe httproute httpbin-route -n test-app
  • IAM Issues: Verify the IAM role has permissions for elasticloadbalancing:CreateLoadBalancer, ec2:Describe*, etc.

Clean Up

Delete resources to avoid costs:

`bash

Delete cluster

eksctl delete cluster --name=eks-autogw-cluster --region=us-east-1

Delete CRDs (optional)

kubectl delete -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.0.0/gateway-api-crds.yaml
`

Conclusion

You’ve successfully configured the Kubernetes Gateway API on an EKS Auto Mode cluster using Envoy Gateway. This setup provides advanced traffic management, TLS termination, and observability. Extend it further with GRPC routes, UDP routing, or policy enforcement based on your needs.

Reference: Configure Kubernetes Gateway API in EKS Auto Mode