FIELD NOTESAWS · KUBERNETES

The Gateway API on EKS: load balancers or VPC Lattice

On EKS the Gateway API has two AWS controllers. The Load Balancer Controller makes each Gateway an ALB or NLB for traffic into the cluster; VPC Lattice makes it a service network between clusters, VPCs and accounts. Choose by the direction of the traffic.

By Glorb4 min readPublished
ON THIS PAGE
Two AWS accounts: users reach an ALB that the Load Balancer Controller made for a Gateway, in front of Service shop in an EKS cluster; Service shop calls Service payments in the other account's cluster through a VPC Lattice service network. Drawn in archhy.

On EKS, "the Gateway API" means two different AWS controllers that answer two different questions. The AWS Load Balancer Controller turns each Gateway into an ALB or an NLB, which is how traffic gets into the cluster. The VPC Lattice controller turns each Gateway into a service network that services in other clusters, VPCs and accounts can join, which is how services reach each other. Pick by the direction of the traffic, not by the feature list: a cluster that serves the internet wants the first.

Both read the same Kubernetes objects: a GatewayClass, a Gateway, routes. The YAML your teams write looks almost identical either way. What differs is what appears in your AWS account when they apply it, and that is what you are really choosing.

The Load Balancer Controller: one Gateway, one load balancer#

The controller you probably already run for Ingress also implements the Gateway API: layer 4 routes from v2.13.3, layer 7 routes from v2.14. It watches two controller names, one per kind of load balancer:

YAML
kind: GatewayClass
metadata:
  name: aws-alb
spec:
  controllerName: gateway.k8s.aws/alb   # HTTPRoute, GRPCRoute
---
kind: GatewayClass
metadata:
  name: aws-nlb
spec:
  controllerName: gateway.k8s.aws/nlb   # TCPRoute, UDPRoute, TLSRoute

Every Gateway that uses the ALB class gets its own Application Load Balancer, and its HTTPRoutes become listener rules and target groups on it. The NLB class does the same with a Network Load Balancer for the layer 4 routes. Three consequences follow, and they are the ones that surprise people coming from Ingress:

  • The number of Gateways is the number of load balancers, and the bill. With Ingress, the controller could merge many Ingresses into one ALB through a group annotation. Here the merge point is the Gateway itself: share one Gateway across teams and let each team attach its own HTTPRoute, rather than giving every team a Gateway.
  • A Gateway is either layer 7 or layer 4. An HTTPRoute and a TCPRoute cannot share a Gateway. If a service needs both, that is two Gateways and two load balancers.
  • Certificates come from ACM, not from Secrets. The controller does not support certificateRefs on a listener. It discovers an ACM certificate from the hostnames on the listener and its routes, or you name one in a LoadBalancerConfiguration that the Gateway points to. So the usual cert-manager flow, which writes a Secret, does not reach the ALB.

Load balancer settings that the Gateway API has no field for (scheme, subnets, attributes, the default certificate) live in the controller's own resources: LoadBalancerConfiguration for the Gateway, TargetGroupConfiguration for a Service's targets, ListenerRuleConfiguration for a rule. That is where the AWS-specific part of your platform will collect.

VPC Lattice: a Gateway is a network, not a front door#

The AWS Gateway API Controller for VPC Lattice uses the GatewayClass amazon-vpc-lattice, and the mapping is different in kind. A Gateway corresponds to a Lattice service network, matched by name. Each HTTPRoute becomes a Lattice service with a domain name that Lattice generates and the controller writes onto the route. Weighted backends work as you would expect, so blue/green and canaries carry over.

YAML
kind: Gateway
metadata:
  name: payments-net        # the service network of the same name
spec:
  gatewayClassName: amazon-vpc-lattice

The project's own documentation says it is focused on east-west traffic, between services, and sends you to the Load Balancer Controller for ingress. Its strength is reach: a route can point at a ServiceImport, so one Lattice service spreads traffic across target groups in several clusters, and service networks can be shared with other accounts through AWS RAM. That can replace much of the VPC peering, Transit Gateway routing and private load balancers you would otherwise build to connect clusters.

The cost is a new set of things to get right. Your nodes' security groups must allow traffic from the VPC Lattice managed prefix lists, the controller needs IAM permissions (EKS Pod Identity is the recommended way), and a VPC has to be associated with the service network before its clients can call anything. Lattice also has its own route limits, among them no query parameter matches and at most five header matches per rule.

How to choose#

  • Users or the internet calling into one cluster: the Load Balancer Controller with the ALB class. Plan your Gateways as you would plan load balancers.
  • TCP, UDP or TLS passthrough into the cluster: the same controller with the NLB class.
  • Services calling services across clusters, VPCs or accounts: VPC Lattice, especially if you would otherwise be wiring networks together or adding a mesh only for that.
  • Calls inside one cluster: often neither. A Service and a network policy may be all you need.

Running both is normal: an ALB Gateway at the edge and a Lattice network behind it. Keep the GatewayClass names obvious, because the route manifest alone does not tell a reviewer which world it lands in.

If you are arriving from Ingress, read the Gateway API for people who know Ingress first. The same choice on the other clouds is in the Gateway API on GKE and on AKS.

The diagram#

Two accounts, two clusters: an ALB Gateway taking traffic from users into the first, and a Lattice service network carrying its calls to a Service in the other. Open it in archhy and make a copy to draw your own.