MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

How to setup Kubernetes AWS Gateway API Controller on Amazon EKS?

The AWS Gateway API Controller lets you use Kubernetes Gateway API resources (Gateway, HTTPRoute, GRPCRoute) on Amazon EKS. Instead of creating a load balancer, the controller turns those resources into Amazon VPC Lattice service networks and services. This page covers every step from cluster creation to a working HTTPRoute. The steps above install the Gateway API CRDs and open the security group to VPC Lattice. The sections below fill in the VPC and EKS steps that are empty, then add the IAM setup, the Helm install, the GatewayClass and an end-to-end test.

Step – Setup Dedicated AWS VPC

Step – Deploy EKS

Step – Installing a Kubernetes Gateway API

$ kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.0/standard-install.yaml

$ kubectl api-resources | grep gateway
Code language: JavaScript (javascript)
Kubectl api-resources filtered by gateway listing GatewayClass, Gateway, GRPCRoute, HTTPRoute and ReferenceGrant

Step – AWS Security group Change Requirement

Amazon VPC Lattice is a fully managed service by AWS that simplifies service-to-service communication across VPCs and accounts. The CIDR blocks used by VPC Lattice are assigned and managed by AWS and are available through managed prefix lists for both IPv4 and IPv6.

To allow communication between your workloads (e.g., Pods in EKS) and VPC Lattice services, you must configure security groups, network ACLs, or resource policies to allow traffic from these AWS-managed prefix lists

Prefix List: A prefix list is a set of CIDR blocks (e.g., 192.0.2.0/24 for IPv4 or 2001:db8::/32 for IPv6) that represent a group of IP addresses.

AWS-managed prefix lists for services like VPC Lattice can be used in:

  • โœ… Security Groups
  • โœ… Route Tables
  • โœ… Network ACLs
  • โœ… Resource Policies

Security Groups Created by AWS for EKS

  • Cluster Security Group (Control Plane to Worker Nodes)
  • Node Security Group (Worker Nodes)
  • Fargate Profile Security Group (if using AWS Fargate)
AWS VPC console Managed prefix lists with the IPv4 and IPv6 vpc-lattice prefix lists marked
Terminal output of aws ec2 authorize-security-group-ingress adding VPC Lattice prefix lists to the EKS cluster security group

EKS cluster security group inbound rules showing new IPv4 and IPv6 vpc-lattice prefix list sources

How the controller maps Gateway API to VPC Lattice

The controller watches Gateway API objects and calls the VPC Lattice API for you. Traffic does not go through an in-cluster proxy or an ELB. VPC Lattice sends requests directly to pod IPs, so the pods must have routable VPC IP addresses. The default Amazon VPC CNI on EKS gives them those addresses.

Kubernetes resourceVPC Lattice resource
GatewayClass (controllerName application-networking.k8s.aws/gateway-api-controller)Selects this controller
GatewayService network with the same name
HTTPRoute / GRPCRouteLattice service with listeners and rules
backendRefs (Kubernetes Service)Target group of pod IPs

The security group change above is required because both VPC Lattice health checks and VPC Lattice data traffic reach your pods from the AWS-managed VPC Lattice prefix lists.

Prerequisites and cluster setup

Install the following tools: AWS CLI v2, eksctl, kubectl, helm (v3.8 or later for OCI charts) and jq. You also need an IAM identity that can create EKS clusters, IAM roles and policies, and VPC Lattice resources. Both the Setup dedicated AWS VPC step and the Deploy EKS step above are empty. eksctl covers both of them, because it creates a dedicated VPC with public and private subnets unless you tell it otherwise.

export AWS_REGION=ap-northeast-1
export CLUSTER_NAME=test-1

# Creates a new VPC, subnets, the EKS control plane and a managed node group
eksctl create cluster --name "$CLUSTER_NAME" --region "$AWS_REGION"

kubectl get nodesCode language: PHP (php)

Note: VPC Lattice is not offered in every AWS Region. Before you create the cluster, check that aws ec2 describe-managed-prefix-lists --region $AWS_REGION lists com.amazonaws.<region>.vpc-lattice.

Corrected security group commands

The gist above follows the upstream documentation, but it has some problems. The $ prompts break copy and paste. The quoting in the --query filter is hard to read. The region comes only from the environment. The version below is equivalent but more robust, and each rule is added only when its prefix list exists:

CLUSTER_SG=$(aws eks describe-cluster --name "$CLUSTER_NAME" --region "$AWS_REGION" \
  --query 'cluster.resourcesVpcConfig.clusterSecurityGroupId' --output text)

PREFIX_LIST_ID=$(aws ec2 describe-managed-prefix-lists --region "$AWS_REGION" \
  --query "PrefixLists[?PrefixListName=='com.amazonaws.${AWS_REGION}.vpc-lattice'].PrefixListId" --output text)

PREFIX_LIST_ID_IPV6=$(aws ec2 describe-managed-prefix-lists --region "$AWS_REGION" \
  --query "PrefixLists[?PrefixListName=='com.amazonaws.${AWS_REGION}.ipv6.vpc-lattice'].PrefixListId" --output text)

echo "SG=$CLUSTER_SG IPv4=$PREFIX_LIST_ID IPv6=$PREFIX_LIST_ID_IPV6"

for PL in $PREFIX_LIST_ID $PREFIX_LIST_ID_IPV6; do
  aws ec2 authorize-security-group-ingress --region "$AWS_REGION" --group-id "$CLUSTER_SG" \
    --ip-permissions "PrefixListIds=[{PrefixListId=${PL}}],IpProtocol=-1"
doneCode language: JavaScript (javascript)

The gist describes this as configuring the nodes' security group, but it changes the cluster security group. That works for EKS managed node groups and Fargate, because those use the cluster security group by default. Self-managed nodes, or node groups with custom security groups, need the same ingress rule on the security group that is attached to the node ENIs.

Note: IpProtocol=-1 allows every port from VPC Lattice. In production, you can limit the rule to your application and health-check ports. Keep in mind that VPC Lattice also needs those ports for health checks.

Grant the controller IAM permissions with EKS Pod Identity

The controller needs IAM permissions to manage VPC Lattice resources. The upstream project publishes a recommended policy. The steps below create that policy, the controller namespace and service account, and a Pod Identity association that links them.

curl -sSLo recommended-inline-policy.json \
  https://raw.githubusercontent.com/aws/aws-application-networking-k8s/main/files/controller-installation/recommended-inline-policy.json

aws iam create-policy --policy-name VPCLatticeControllerIAMPolicy \
  --policy-document file://recommended-inline-policy.json

export VPCLatticeControllerIAMPolicyArn=$(aws iam list-policies \
  --query 'Policies[?PolicyName==`VPCLatticeControllerIAMPolicy`].Arn' --output text)

# Namespace and service account used by the controller
kubectl create namespace aws-application-networking-system
kubectl create serviceaccount gateway-api-controller -n aws-application-networking-system

# Pod Identity agent add-on (skip if already installed)
aws eks create-addon --cluster-name "$CLUSTER_NAME" --region "$AWS_REGION" \
  --addon-name eks-pod-identity-agent

cat > pod-identity-trust.json <<'EOF'
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": { "Service": "pods.eks.amazonaws.com" },
    "Action": ["sts:AssumeRole", "sts:TagSession"]
  }]
}
EOF

aws iam create-role --role-name VPCLatticeControllerIAMRole \
  --assume-role-policy-document file://pod-identity-trust.json
aws iam attach-role-policy --role-name VPCLatticeControllerIAMRole \
  --policy-arn "$VPCLatticeControllerIAMPolicyArn"

ROLE_ARN=$(aws iam get-role --role-name VPCLatticeControllerIAMRole --query 'Role.Arn' --output text)

aws eks create-pod-identity-association --cluster-name "$CLUSTER_NAME" --region "$AWS_REGION" \
  --namespace aws-application-networking-system \
  --service-account gateway-api-controller \
  --role-arn "$ROLE_ARN"

Note: If you already use IRSA, you can skip Pod Identity. Instead, run eksctl create iamserviceaccount with the same namespace, service account name and policy ARN, and add --override-existing-serviceaccounts --approve.

Install the controller and the GatewayClass

Install the Gateway API CRDs first, as in the steps above. Then install the controller from its public ECR Helm chart. Set serviceAccount.create=false so the chart uses the service account that already has the IAM association. If you leave out --version, Helm pulls the latest chart. In production, pin the version shown on the project's releases page. Also check that the Gateway API CRD version you installed is one that release supports.

helm install gateway-api-controller \
  oci://public.ecr.aws/aws-application-networking-k8s/aws-gateway-controller-chart \
  --namespace aws-application-networking-system \
  --set serviceAccount.create=false \
  --set serviceAccount.name=gateway-api-controller \
  --set log.level=info

kubectl get pods -n aws-application-networking-systemCode language: JavaScript (javascript)

Next, create the GatewayClass that points Gateway objects at this controller:

apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
  name: amazon-vpc-lattice
spec:
  controllerName: application-networking.k8s.aws/gateway-api-controller

After you apply it, kubectl get gatewayclass amazon-vpc-lattice should show ACCEPTED as True. kubectl api-resources | grep -E 'gateway|application-networking' should list the standard Gateway API kinds plus the controller's own CRDs, such as TargetGroupPolicy, ServiceExport and ServiceImport.

Verify with a service network, Gateway and HTTPRoute

  1. Create a VPC Lattice service network and associate it with the cluster VPC. Clients can only resolve and reach Lattice services from VPCs that are associated with the service network.
  2. Deploy a test app and a Gateway whose name matches the service network name.
  3. Create an HTTPRoute that routes to the app's Service.
  4. Read the DNS name that Lattice assigned and call it from a pod.
aws vpc-lattice create-service-network --name my-hotel --region "$AWS_REGION"
SN_ID=$(aws vpc-lattice list-service-networks --region "$AWS_REGION" \
  --query "items[?name=='my-hotel'].id" --output text)
VPC_ID=$(aws eks describe-cluster --name "$CLUSTER_NAME" --region "$AWS_REGION" \
  --query 'cluster.resourcesVpcConfig.vpcId' --output text)
aws vpc-lattice create-service-network-vpc-association --region "$AWS_REGION" \
  --service-network-identifier "$SN_ID" --vpc-identifier "$VPC_ID"

kubectl create deployment inventory --image=public.ecr.aws/nginx/nginx:latest --port=80
kubectl expose deployment inventory --port=80Code language: JavaScript (javascript)
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: my-hotel            # must match the service network name
spec:
  gatewayClassName: amazon-vpc-lattice
  listeners:
  - name: http
    protocol: HTTP
    port: 80
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: inventory
spec:
  parentRefs:
  - name: my-hotel
    sectionName: http
  rules:
  - backendRefs:
    - name: inventory
      kind: Service
      port: 80Code language: PHP (php)
DNS=$(kubectl get httproute inventory \
  -o jsonpath='{.metadata.annotations.application-networking\.k8s\.aws/lattice-assigned-domain-name}')
echo "$DNS"

kubectl run curl-test --rm -it --restart=Never --image=curlimages/curl -- curl -s "http://$DNS"Code language: PHP (php)

The last command should print the nginx welcome page. The annotation can take a minute to appear while the controller creates the Lattice service and target group.

Troubleshooting

SymptomLikely causeFix
PREFIX_LIST_ID is emptyWrong Region, or VPC Lattice not available thereCheck $AWS_REGION and list the managed prefix lists
InvalidPermission.DuplicateThe ingress rule already existsSafe to ignore
AccessDenied in controller logsPod started before the Pod Identity association existed, or the policy is not attachedCheck the association, then kubectl rollout restart deploy -n aws-application-networking-system
No DNS annotation on the HTTPRouteGateway name does not match a service network, or wrong gatewayClassNamekubectl describe gateway my-hotel and check the controller logs
DNS name does not resolveClient VPC not associated with the service networkCreate the service network VPC association
Requests time out or return 5xx, targets unhealthyPrefix list rule missing on the security group the pods actually useAdd the rule to the node or pod security group

To read the controller logs, run kubectl get deploy -n aws-application-networking-system to find the deployment name. Then run kubectl logs -n aws-application-networking-system deploy/<name>.

Best practices and cleanup

  • Pin both the Helm chart version and the Gateway API CRD version, and upgrade them together.
  • Use VPC Lattice auth policies (IAM) on service networks or services when traffic should not be open to every associated VPC.
  • Manage the security group rule and the IAM role in Terraform or CloudFormation so they are not lost when the cluster is rebuilt.
  • Delete Kubernetes resources before you delete the cluster: kubectl delete httproute inventory and kubectl delete gateway my-hotel. If you delete the cluster first, the controller cannot clean up, and you are left with orphaned Lattice services and target groups that you must delete yourself.

Frequently asked questions

Does the AWS Gateway API Controller create an Application Load Balancer?

No. It creates Amazon VPC Lattice service networks, services and target groups. For ALB or NLB provisioning, use the AWS Load Balancer Controller instead.

Why do I need to allow the VPC Lattice prefix list in the security group?

VPC Lattice sends health checks and client traffic directly to pod IPs from AWS-managed address ranges. If the pods' security group does not allow those prefix lists, targets show as unhealthy and requests fail.

What does a Gateway map to in VPC Lattice?

Each Gateway that uses the amazon-vpc-lattice GatewayClass maps to a VPC Lattice service network with the same name. Each HTTPRoute or GRPCRoute becomes a Lattice service in that network.

Can I use IRSA instead of EKS Pod Identity for the controller?

Yes. Both work. Attach the same IAM policy to a role and bind that role to the gateway-api-controller service account in the aws-application-networking-system namespace.

Can services in other VPCs or AWS accounts call routes on this cluster?

Yes, if their VPC is associated with the same service network. For other accounts, share the service network through AWS RAM. Auth policies control which callers are allowed.

Related tutorials

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

AWS Architect & Design – Decision Matrix: NAT per AZ vs Single NAT vs Regional NAT for EKS Environments

Final comparison table (all approaches) Approach Architecture (AZ / NAT) Design Cost profile Parity to PROD Terraform complexity Risk Best-practice fit Pros Cons Typical fit (envs) A….

Read More

Kubernetes: How to Run a Pod and Get the EGRESS IP Address KubernetesEKS

1. Deploy a Pod to Your Cluster You can launch a simple Pod using the kubectl run command. For example, to run an NGINX Pod: bashkubectl run…

Read More

AWS – EKS – How to make EKS API Server Private

Deploying to a Private EKS Cluster Using Terraform Cloud (TFC) By default, Terraform Cloud (TFC) workspaces require network-level access to the EKS API endpoint to deploy workloads…

Read More

Difference between AWS Load Balancer Controller Vs Kubernetes Gateway API Controller for AWS VPC Lattice

AWS Load Balancer Controller vs Kubernetes Gateway API Controller for AWS VPC Lattice Overview Table Feature AWS Load Balancer Controller Kubernetes Gateway API Controller for VPC Lattice…

Read More

AWS Tutorials: AWS Gateway API Controller Setup Verification Checklist on EKS

โœ… AWS Gateway API Controller Setup Verification Checklist for Kubernetes Gateway API (EKS) This guide ensures a full production-ready setup for AWS Gateway API Controller integrated with…

Read More

EKS Tutorials: Types of Security Groups Created or Used in an EKS Cluster

When you set up an Amazon EKS (Elastic Kubernetes Service) cluster, AWS automatically creates and/or requires several security groups to manage access to the control plane, worker…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x