Module 8 ยท Lesson 8.2
Gateway API
Splitting one object into the right roles
Ingress bundles everything into one object, owned by whoever creates it.
In practice that's often wrong: a platform team owns the shared load
balancer and TLS certs, while an app team just wants to say "route /api
to my Service" โ and shouldn't need permission to touch the load balancer
config to do it.
Gateway API splits that into three resources along exactly that boundary:
- GatewayClass โ the controller/implementation (cluster-scoped, usually
platform-owned) โ
traefik, in this cluster. - Gateway โ one real listener: a protocol, a port, a hostname โ the shared infrastructure, platform-owned.
- HTTPRoute (or
GRPCRoute,TCPRoute, ...) โ the actual routing rules, attached to a Gateway, app-team-owned, living in the app's own namespace.
Ownership split by resource, not by convention
Platform team owns this
ns: team-api
ns: team-blog
Why this is the one SIG Network points you toward
Three things Ingress structurally can't do well, which is why it's the recommended Ingress successor, not just an alternative flavor of the same idea:
- Role separation that RBAC can actually enforce โ an app team can create HTTPRoutes in their own namespace without ever touching the Gateway, because they're different objects with different owners.
- Portable advanced routing. Header matching, traffic splitting
(weighted backends for canaries), and request mirroring are typed
fields on
HTTPRouteโ standard API, not per-controller annotations. The rate-limit problem from last lesson doesn't exist here for anything the spec covers. - One Gateway, many protocols and route kinds โ HTTP, gRPC, raw TCP โ through one shared listener set, instead of Ingress's HTTP-only model bolted onto by annotation for everything else.
What stays the same
The controller/resource split you already know is identical: a GatewayClass with no controller behind it does nothing, just like an Ingress with no controller. Traefik implements Gateway API here the same way it implements Ingress โ same binary, same Service, different watch loop.
The infrastructure analogy
Think of the old single Ingress object as one person holding both the network team's F5/ALB config and every app team's URL rules in one file everyone edits. Gateway API is what happens when you actually split that by team, with the platform team's layer enforced by Kubernetes RBAC instead of a change-review process.
In the lab, you'll build the same routing outcome as last lesson's Ingress lab โ a Gateway plus an HTTPRoute โ and verify it the same way, from inside the cluster.
๐งช Lab: lab-17-gateway-api
Preview onlyGoal
Build the same two-path routing outcome as the Ingress lab, through Gateway
API's three-resource split instead โ and fix the same style of
wrong-backend bug, now in an HTTPRoute.
Tasks
- Apply the starting manifests:
kubectl apply -f manifests/ - Check everything landed:
kubectl get gateway,httproute,pods -n lab-17-gateway-api - Check the Gateway itself is accepted by Traefik:
kubectl describe gateway web-gateway -n lab-17-gateway-apiโ look forAccepted: Truein the status conditions. - Test
/blogfrom inside the cluster (already correct):
Expectkubectl exec -n lab-17-gateway-api client -- wget -q -O- \ --header="Host: gw.example.com" \ http://traefik.traefik-system.svc.cluster.local/bloghello from blog-backend. - Test
/apithe same way โ you'll gethello from blog-backendagain. Same bug as the Ingress lab, same lesson: abackendRefis just a name and a port, and nothing validates it points where you meant. - Open
manifests/httproute.yaml, find the comment, and fix the/apirule'sbackendRefto point atapi-svc, port8080. - Re-apply:
kubectl apply -f manifests/httproute.yaml - Re-test
/apiโ expecthello from api-backend.
Check
Run the check once both paths return their correct backend's text.
This lab runs against a real local Kubernetes cluster with an automated grader โ clone the repo and run make start to do it for real.
๐ Quiz
1. Which of these are the three core Gateway API resources? (select all that apply)
2. A platform team wants app teams to add their own routing rules without ever being able to touch shared TLS/listener config. How does Gateway API make this enforceable?scenario
3. Why is weighted traffic splitting (e.g. 90% v1 / 10% v2 for a canary) more portable in Gateway API than in Ingress?
4. You create a GatewayClass, a Gateway, and an HTTPRoute, but no controller in the cluster implements that GatewayClass's controllerName. What happens?scenario
5. Why does Kubernetes SIG Network specifically recommend Gateway API as a destination for ingress-nginx users, rather than just 'pick any other Ingress controller'?
Progress isn't saved in this preview โ run the course locally to track completion and grade labs for real.