Sub topic 3
The Gateway API resource model and roles
This chapter assumes you know Pods, Services, Namespaces and kubectl, and that you have used an Ingress with a controller such as Ingress NGINX. It covers the resources the Gateway API adds and who is meant to own each one. Later chapters write the manifests in detail.
Why the model has several resources
An Ingress is one object that holds everything: the controller choice, the listening ports, TLS, and the routing rules. Annotations carry the rest. That is simple, but it forces one team to own the whole thing, or forces teams to edit the same object.
The Gateway API splits that object by responsibility. Each resource has a different owner, and the resources link to each other by reference.
The three roles
The Gateway API design names three personas. They are roles, not people. One person can fill all three in a small cluster.
- Infrastructure provider. Supplies the implementation and defines what it can do.
- Cluster operator. Runs shared entry points, decides which ports and protocols are open, and manages certificates.
- Application developer. Owns the routing rules for one application and attaches them to an entry point.
The core resources
| Resource | Owner | Purpose | Closest Ingress idea |
|---|---|---|---|
| GatewayClass | Infrastructure provider | Names an implementation (a controller) | `ingressClassName` |
| Gateway | Cluster operator | Listeners: ports, protocols, hostnames, TLS | Ports and `tls` section |
| HTTPRoute | Application developer | Host, path and header matches, filters, backends | `rules` and many annotations |
| ReferenceGrant | Owner of the target namespace | Permits a reference across namespaces | No equivalent |
A GatewayClass is cluster-scoped. A Gateway asks for a class and declares listeners. A listener is a port and protocol pair, optionally with a hostname and TLS settings. An HTTPRoute holds the rules and points at a Gateway through parentRefs. The route then sends traffic to Services through backendRefs.
Who points at whom
The references run from the more specific resource to the more general one. A route names the Gateway it wants. A Gateway names its class. The Gateway also controls who may attach, through allowedRoutes on each listener. This is a change from Ingress, where any Ingress in any namespace could claim a host if the controller allowed it.
The result is a two-sided agreement. The route asks to attach, and the listener must accept. The route's status then reports whether the attachment worked.
Status is part of the model
Every resource reports conditions in its status. A Gateway shows Accepted and Programmed. A route shows Accepted and ResolvedRefs for each parent. Ingress gave you little feedback beyond events and controller logs. You will rely on these conditions during migration to check your work before sending real traffic.
kubectl get gatewayclass
kubectl get gateway -A
kubectl get httproute -AThe first command lists the classes your cluster offers. If it returns nothing, no implementation is installed, and no Gateway can work.
Exercise
A developer in the namespace shop creates an HTTPRoute that names a Gateway in gateway-system, but the route is never attached. Name two parts of the model you would check.
Show answer
Check the Gateway listener's allowedRoutes, which may not permit routes from the shop namespace. Also check the route's parentRefs (name, namespace and sectionName) and the Accepted condition in the route's status, which states why attachment failed.