Skip to content

05 — Gateway API

The role-oriented, typed successor to Ingress: GatewayClass → Gateway → HTTPRoute (+ ReferenceGrant), why it supersedes Ingress (expressiveness, portability, typed routing, multi-protocol, infra/app separation), status conditions, and the Ingress→Gateway migration — applied by re-expressing the ch.04 Bookstore routing as a Gateway + HTTPRoute alternative.

Estimated time: ~15 min read · ~60 min hands-on Prerequisites: Part 02 ch.04 — Ingress, the predecessor it replaces · Part 02 ch.02 — the backend Services HTTPRoutes target You'll know after this: • differentiate GatewayClass, Gateway, HTTPRoute, and ReferenceGrant roles · • explain why Gateway API supersedes Ingress (typed, multi-protocol, infra/app split) · • read Gateway and HTTPRoute status conditions to diagnose problems · • use listener allowedRoutes to decide which namespaces may attach routes, and ReferenceGrant to permit cross-namespace backends and certificates · • migrate an Ingress-based setup to Gateway + HTTPRoute

Why this exists

ch.04 exposed the Bookstore, but exposed Ingress's ceilings: everything beyond host/path is controller-specific annotation string-soup (the Bookstore's path rewrite is a Traefik Middleware, attached through an annotation that only Traefik reads), there is one role (no separation between the team that owns the cluster's edge/TLS and the team that owns their service's routes), it is HTTP-only, and the annotation surface is unvalidated (typos fail silently at the controller).

Gateway API is the project's answer: a set of typed, portable CRDs that expresses routing as first-class spec fields (not annotations), splits the infrastructure concern from the application concern, supports HTTP/TLS/TCP/UDP/gRPC, and reports machine-readable status conditions. For the Bookstore it means the same edge routing as 50-ingress.yaml — but portable across implementations and split along team lines. This is the forward-looking Service Routing model; Gateway API v1 (GA) covers GatewayClass, Gateway, and HTTPRoute.

Mental model

Gateway API is Ingress, refactored into three objects owned by two roles.

  • GatewayClass (cluster-scoped, infra) — "this kind of Gateway is implemented by that controller". Analogous to a StorageClass / IngressClass.
  • Gateway (infra/platform team) — the actual entrypoint: listeners (port, protocol, hostname), TLS termination, and which routes may attach. This is the cluster's front door; the platform team owns it.
  • HTTPRoute (application team) — "for host X, path /api/books → Service catalog:80, rewrite to /books". It attaches to a Gateway via parentRefs. The app team owns their routes without touching the shared entrypoint or TLS.
  • ReferenceGrant (resource owner) — explicit, auditable permission for a cross-namespace reference: an HTTPRoute in ns A sending traffic to a Service in ns B, or a listener in ns A reading a TLS Secret in ns B. The owner of the target creates it. Cross-namespace references are deny-by-default; the grant is opt-in.

Attaching a route to a Gateway is a different decision, and no ReferenceGrant is involved. The Gateway's allowedRoutes names the namespaces that may attach, and the listener's hostname names the hosts they may claim.

So the leap from Ingress is: one annotated object, one role → typed objects split by responsibility, with the routing options (rewrite, weighting, header matching, timeouts) as validated spec fields instead of stringly-typed annotations. It is CRD-installed — not built into Kubernetes — so the CRDs + a controller must be present first.

Threats and controls

Threat Control taught here Goes deeper
A route in another team's namespace attaches to the shared Gateway and claims the Bookstore's host or path The listener's hostname and allowedRoutes: only the namespaces you name may attach, and only for hosts the listener serves Part 05 ch.01 for who may create routes
A route sends traffic to a Service, or a listener reads a Secret, in a namespace whose owner did not agree ReferenceGrant in the target namespace, naming the source namespace and kind it accepts and the target's kind and name Part 05 ch.01

Controller-level risk, such as a controller that reads every Secret, is ch.04's subject. The production notes below cover what the Gateway provider adds on top of it.

Diagrams

Object relationships (Mermaid)

flowchart TB
    subgraph infra["INFRA / platform team owns"]
        gc["GatewayClass: bookstore-gtw
controllerName: traefik.io/gateway-controller
(cluster-scoped)"] gw["Gateway: bookstore (ns bookstore)
listener HTTPS:8443 (Service port 443)
hostname bookstore.localdev.me
TLS Terminate ← Secret bookstore-tls
allowedRoutes: Same namespace"] end subgraph app["APP team owns"] hr["HTTPRoute: bookstore (ns bookstore)
parentRefs: Gateway 'bookstore'
/api/books → catalog:80 (rewrite /books)
/api/orders → orders:80 (rewrite /orders)
/ → storefront:80"] end subgraph svcs["Services (ch.02, 40-services.yaml)"] sc["catalog:80"] so["orders:80"] ss["storefront:80"] end rg["ReferenceGrant
(ONLY for a backendRef or certificateRef
into another namespace; Bookstore is same-ns)"] gc -->|"GatewayClass implemented by controller"| gw hr -->|"parentRefs: attaches to"| gw hr -->|backendRefs| sc hr --> so hr --> ss rg -.->|"would authorize a cross-ns backendRef"| hr

Persona separation (ASCII)

                 GATEWAY API ROLE SPLIT (the core idea)
 ─────────────────────────────────────────────────────────────────────────────
  INFRASTRUCTURE PROVIDER  ─ owns ─►  GatewayClass   (which controller)
  PLATFORM / CLUSTER OPS   ─ owns ─►  Gateway        (listeners, TLS, who may attach)
  APPLICATION DEVELOPER    ─ owns ─►  HTTPRoute      (my paths → my Services)
  RESOURCE OWNER           ─ owns ─►  ReferenceGrant (allow a cross-ns reference)

  Ingress (ch.04):  ONE object, ONE role, controller-specific ANNOTATIONS.
  Gateway API:      typed objects, split by responsibility, PORTABLE fields.
  RBAC can now grant app teams HTTPRoute WITHOUT granting edge/TLS control.

Hands-on with the Bookstore

Assumed working directory: the guide repo root (full-guide/). Requires the bookstore namespace, the Services from ch.02 (40-services.yaml) and their Deployments, plus a TLS Secret bookstore-tls in bookstore (created in ch.04 step 4, reused as-is).

Alternative, not addition: apply the Gateway API stack or the Ingress stack, never both. 51-gateway.yaml expresses the same external routing as the Traefik Ingress from ch.04 step 6 (50-ingress-traefik.yaml), via a different data plane. Running both binds the same hostname/paths twice. Choose one stack: Ingress = 40- + the ch.04 Ingress; Gateway API = 40- + 51-. A client dry-run does not detect the runtime hostname overlap, and Gateway kinds only map once the CRDs are installed (intrinsic to Gateway API being CRD-based). To switch from the ch.04 stack, delete the file that holds that Ingress and its Middleware: kubectl delete -f 50-ingress-traefik.yaml.

1. Install the Gateway API CRDs and the Traefik Gateway provider

Gateway API is not in core Kubernetes. Install the CRDs, then turn on the Gateway provider in Traefik. Traefik is the controller ch.04 installs for Ingress. One Traefik serves both APIs: the Ingress provider stays on, and the Gateway provider joins it. The CRD version is a decision, and the note after the controller check explains it: this lab ran v1.7.0, and Traefik's documentation names v1.6.3.

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

kubectl get crd | grep gateway.networking.k8s.io
kubectl get crd httproutes.gateway.networking.k8s.io \
  -o jsonpath='{.metadata.annotations.gateway\.networking\.k8s\.io/channel}{"\n"}'

The list shows the kinds the install registered, and the annotation gives the channel, standard:

backendtlspolicies.gateway.networking.k8s.io   Namespaced   v1(storage)           2026-10-31T01:02:23Z
gatewayclasses.gateway.networking.k8s.io       Cluster      v1(storage),v1beta1   2026-10-31T01:02:23Z
gateways.gateway.networking.k8s.io             Namespaced   v1(storage),v1beta1   2026-10-31T01:02:23Z
grpcroutes.gateway.networking.k8s.io           Namespaced   v1(storage)           2026-10-31T01:02:24Z
httproutes.gateway.networking.k8s.io           Namespaced   v1(storage),v1beta1   2026-10-31T01:02:25Z
listenersets.gateway.networking.k8s.io         Namespaced   v1(storage)           2026-10-31T01:02:25Z
referencegrants.gateway.networking.k8s.io      Namespaced   v1,v1beta1(storage)   2026-10-31T01:02:26Z
tcproutes.gateway.networking.k8s.io            Namespaced   v1(storage)           2026-10-31T01:02:27Z
tlsroutes.gateway.networking.k8s.io            Namespaced   v1(storage)           2026-10-31T01:02:29Z
udproutes.gateway.networking.k8s.io            Namespaced   v1(storage)           2026-10-31T01:02:30Z
standard

The kind list alone does not give the channel. The standard install also registers TLSRoute, TCPRoute and UDPRoute, so read the annotation.

The traefik namespace and its Pod Security labels come from ch.04 step 2, so this step changes only the release.

The values from ch.04 stay in force: the watch list, the IngressClass default and the pinned image. This step adds the Gateway provider in a second file. Helm applies the files in order, and the second file holds only the Gateway keys:

providers:
  kubernetesGateway:
    enabled: true                # the Gateway API provider, beside the Ingress one
gateway:
  enabled: false                 # the Bookstore's own Gateway (51-) replaces
                                 # the chart's default one

Save it as traefik-gateway-values.yaml, then upgrade the ch.04 release in place. The release name and namespace stay the same:

helm repo add traefik https://traefik.github.io/charts
helm repo update traefik
helm upgrade --install traefik traefik/traefik --version 42.2.0 \
  --namespace traefik --values traefik-values.yaml \
  --values traefik-gateway-values.yaml

The chart renders a GatewayClass named traefik. Read its controllerName, then check that the running controller accepts the class:

kubectl get gatewayclass traefik -o jsonpath='{.spec.controllerName}{"\n"}'
kubectl get gatewayclass traefik \
  -o jsonpath='{.status.conditions[?(@.type=="Accepted")].status}{"\n"}'
traefik.io/gateway-controller
True

The value is traefik.io/gateway-controller, and 51-gateway.yaml uses it. Use the controllerName your own controller advertises for any other implementation.

Which CRD version. Three versions are in play, and they disagree. The chart's installer notes, printed by the upgrade above, name Gateway API v1.5.1 for Traefik v3.7. Traefik's v3.7 documentation says "This provider supports Standard version v1.6.3 of the Gateway API specification", and gives the standard-install.yaml of that release as the install (Traefik Gateway API provider). This chapter ran v1.7.0, which is newer than both. The Gateway was accepted and programmed and every request below behaved, but the documentation does not promise that pairing. Follow the documentation: the chart note sits oddly beside it and looks out of date. On a cluster you keep, install v1.6.3 by changing the version in the URL of step 1. The kinds listed there are v1.7.0's, so your list may differ. The lab's CRDs are v1.7.0 because the first run of this chapter installed them and left them in place: they are cluster-scoped and the cluster is shared.

The kind cluster needs a host port for each NodePort. Add these two mappings under the control-plane node in the cluster config from ch.04. If that cluster lacks them, recreate it with them:

nodes:
  - role: control-plane
    extraPortMappings:
      - containerPort: 30080     # Traefik web NodePort
        hostPort: 80
        listenAddress: "127.0.0.1"
        protocol: TCP
      - containerPort: 30443     # Traefik websecure NodePort
        hostPort: 443
        listenAddress: "127.0.0.1"
        protocol: TCP

listenAddress keeps the ports on localhost, as in ch.04 step 1.

Without the mapping, forward the Service and send the requests in steps 2 and 4 to port 8443 on the loopback address:

kubectl port-forward -n traefik svc/traefik 8443:443
curl -sS --resolve bookstore.localdev.me:8443:127.0.0.1 --cacert tls.crt \
  https://bookstore.localdev.me:8443/api/books

2. The Gateway and HTTPRoute (same routing as ch.04, typed)

51-gateway.yaml holds three objects: the GatewayClass, the Gateway and the HTTPRoute. The GatewayClass names the controller, traefik.io/gateway-controller, from step 1. The fields that carry the controls are these two fragments, taken from the file.

The Gateway, which the platform team owns:

spec:
  gatewayClassName: bookstore-gtw
  listeners:
    - name: https
      protocol: HTTPS            # the only listener: nothing serves plaintext
      port: 8443                 # Traefik's websecure entryPoint; the Service
                                 # maps client port 443 to it
      hostname: bookstore.localdev.me   # a route attaches only for this host
      tls:
        mode: Terminate          # TLS ends at the Gateway
        certificateRefs:
          - kind: Secret
            name: bookstore-tls  # the ch.04 Secret, in this namespace
      allowedRoutes:
        namespaces:
          from: Same             # only routes in this namespace may attach

The certificate is the self-signed Secret from ch.04. In production cert-manager issues and renews it, and the Certificate that does so is written out in 13.07, not run.

The HTTPRoute, which the application team owns. Its rules repeat the Ingress routes from ch.04 as typed fields:

spec:
  parentRefs:
    - name: bookstore            # attaches to the Gateway above
  hostnames:
    - bookstore.localdev.me
  rules:
    - matches:
        - path: { type: PathPrefix, value: /api/books }
      filters:
        - type: URLRewrite
          urlRewrite:
            path: { type: ReplacePrefixMatch, replacePrefixMatch: /books }
      backendRefs:
        - name: catalog
          port: 80
    - matches:
        - path: { type: PathPrefix, value: /api/orders }
      filters:
        - type: URLRewrite
          urlRewrite:
            path: { type: ReplacePrefixMatch, replacePrefixMatch: /orders }
      backendRefs:
        - name: orders
          port: 80
    - matches:
        - path: { type: PathPrefix, value: / }
      backendRefs:
        - name: storefront
          port: 80

Apply the Gateway-API stack only, then check its status conditions. Unlike an Ingress, the objects report whether they are working:

# from the repo root (full-guide/); 50-ingress.yaml must not be applied
kubectl apply -f examples/bookstore/raw-manifests/51-gateway.yaml
kubectl get gateway,httproute -n bookstore
kubectl get gateway bookstore -n bookstore \
  -o jsonpath='{range .status.conditions[*]}{.type}={.status}{"\n"}{end}'
kubectl get httproute bookstore -n bookstore \
  -o jsonpath='{range .status.parents[0].conditions[*]}{.type}={.status}{"\n"}{end}'

The Gateway reports Accepted and Programmed, and the route reports Accepted and ResolvedRefs. Captured on the lab:

Accepted=True
Programmed=True
Accepted=True
ResolvedRefs=True

Programmed=True means Traefik has configured its data plane. The route's ResolvedRefs=True means every backend Service in its rules resolved. The TLS Secret is a listener condition, so read the listener's conditions for it:

kubectl get gateway bookstore -n bookstore \
  -o jsonpath='{range .status.listeners[*]}{.name}: {range .conditions[*]}{.type}={.status} {end}{"\n"}{end}'
https: Accepted=True ResolvedRefs=True Programmed=True

Check TLS with the certificate from ch.04 step 4. Verify against tls.crt rather than skipping verification with -k:

openssl s_client -connect bookstore.localdev.me:443 -servername bookstore.localdev.me \
  </dev/null 2>/dev/null | openssl x509 -noout -subject -ext subjectAltName
curl -sS --cacert tls.crt https://bookstore.localdev.me/api/books \
  -w "\nHTTP %{http_code}\n"

The certificate's subject and SAN come from the listener's Secret, and the request succeeds only if the certificate verifies. Captured on the lab, where the request went to the node's NodePort and the certificate was checked from inside the node:

subject=CN=bookstore.localdev.me
X509v3 Subject Alternative Name:
    DNS:bookstore.localdev.me
[]
HTTP 200

The list is empty on a fresh database, so HTTP 200 is the result to read: the route reached the catalog Pods, and their rewrite to /books worked. The list fills once the catalog has rows, and it needs the PostgreSQL and Redis from the earlier chapters to be Ready.

3. Who may attach a route

from: Same in 51-gateway.yaml lets only routes in bookstore attach to the Gateway. Attachment is the Gateway owner's decision, so no ReferenceGrant is involved. To let another team's namespace attach, the platform team widens the listener to a label selector:

kubectl patch gateway bookstore -n bookstore --type=json -p='[
  {"op": "replace", "path": "/spec/listeners/0/allowedRoutes/namespaces",
   "value": {"from": "Selector",
             "selector": {"matchLabels": {"bookstore-routes": "allowed"}}}}]'

A selector matches the Gateway's own namespace only when that namespace carries the label too. Without it, the Bookstore's own route stops attaching:

kubectl get httproute bookstore -n bookstore -o jsonpath='{range .status.parents[0].conditions[*]}{.type}={.status} {.reason}{"\n"}{end}'
Accepted=False NotAllowedByListeners
ResolvedRefs=True ResolvedRefs

Label the namespace, and the route attaches again:

kubectl label namespace bookstore bookstore-routes=allowed
kubectl get httproute bookstore -n bookstore -o jsonpath='{range .status.parents[0].conditions[*]}{.type}={.status} {.reason}{"\n"}{end}'
Accepted=True Accepted
ResolvedRefs=True ResolvedRefs

The label is the approval. Only the platform team may set it, so RBAC must not let a team edit the labels of its own namespace: a team that can label itself bookstore-routes: allowed has approved itself. The patch is not in 51-gateway.yaml, so applying that file does not undo it. To go back, patch the listener's from to Same and remove the label.

The first team gets an approved namespace and a route under /team-a. The route is complete as applied:

apiVersion: v1
kind: Namespace
metadata:
  name: team-a
  labels:
    bookstore-routes: allowed    # set by the platform team
    pod-security.kubernetes.io/enforce: restricted
    pod-security.kubernetes.io/enforce-version: latest
    pod-security.kubernetes.io/audit: restricted
    pod-security.kubernetes.io/audit-version: latest
    pod-security.kubernetes.io/warn: restricted
    pod-security.kubernetes.io/warn-version: latest
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: team-a-books
  namespace: team-a
spec:
  parentRefs:
    - name: bookstore
      namespace: bookstore
  hostnames:
    - bookstore.localdev.me
  rules:
    - matches:
        - path: { type: PathPrefix, value: /team-a }
      filters:
        - type: URLRewrite
          urlRewrite:
            path: { type: ReplacePrefixMatch, replacePrefixMatch: / }
      backendRefs:
        - name: catalog
          namespace: bookstore   # a Service in another namespace
          port: 80

Its route attaches, and its backend does not resolve yet. Its owner has not granted anything (step 4):

kubectl get httproute team-a-books -n team-a -o jsonpath='{range .status.parents[0].conditions[*]}{.type}={.status} {.reason}{"\n"}{end}'
Accepted=True Accepted
ResolvedRefs=False RefNotPermitted

A second team's namespace has no label, so its route must be refused. This route is a deliberate failure: it claims the Bookstore's own path and must not attach:

apiVersion: v1
kind: Namespace
metadata:
  name: team-b                   # not labelled bookstore-routes: allowed
  labels:
    pod-security.kubernetes.io/enforce: restricted
    pod-security.kubernetes.io/enforce-version: latest
    pod-security.kubernetes.io/audit: restricted
    pod-security.kubernetes.io/audit-version: latest
    pod-security.kubernetes.io/warn: restricted
    pod-security.kubernetes.io/warn-version: latest
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: takeover                 # deliberate: must NOT attach
  namespace: team-b
spec:
  parentRefs:
    - name: bookstore
      namespace: bookstore
  hostnames:
    - bookstore.localdev.me
  rules:
    - matches:
        - path: { type: PathPrefix, value: /api/books }
      backendRefs:
        - name: catalog
          namespace: bookstore
          port: 80

The refusal shows in the route's status. Both conditions fail here: the listener refuses the attachment, and the Service has no grant either:

kubectl get httproute takeover -n team-b -o jsonpath='{range .status.parents[0].conditions[*]}{.type}={.status} {.reason}{"\n"}{end}'
Accepted=False NotAllowedByListeners
ResolvedRefs=False RefNotPermitted

takeover never attaches, so /api/books still goes to the Bookstore's own route.

4. Cross-namespace references need a ReferenceGrant

team-a-books attaches but cannot reach catalog: the Service lives in bookstore, and the owner of that Service has not agreed. The owner grants it with a ReferenceGrant in its own namespace. The grant names one source namespace, one source kind, and one target kind and name:

apiVersion: gateway.networking.k8s.io/v1
kind: ReferenceGrant
metadata:
  name: team-a-to-catalog
  namespace: bookstore           # the namespace that owns the Service
spec:
  from:
    - group: gateway.networking.k8s.io
      kind: HTTPRoute
      namespace: team-a
  to:
    - group: ""
      kind: Service
      name: catalog

Save the grant as referencegrant.yaml, apply it, and wait until the route reports ResolvedRefs=True. The controller reconciles the grant a moment after the apply, so a check straight after the apply can still show the old value. Then fetch a book through the team's path:

kubectl apply -f referencegrant.yaml
kubectl wait httproute team-a-books -n team-a \
  --for=jsonpath='{.status.parents[0].conditions[?(@.type=="ResolvedRefs")].status}'=True \
  --timeout=60s
kubectl get httproute team-a-books -n team-a -o jsonpath='{range .status.parents[0].conditions[*]}{.type}={.status} {.reason}{"\n"}{end}'
curl -sS --cacert tls.crt https://bookstore.localdev.me/team-a/books -w "\nHTTP %{http_code}\n"
Accepted=True Accepted
ResolvedRefs=True ResolvedRefs
[]
HTTP 200

Deleting the grant withdraws the consent at once. The route's ResolvedRefs goes back to False, and the Service stops being reachable through it:

kubectl delete referencegrant team-a-to-catalog -n bookstore
kubectl get httproute team-a-books -n team-a -o jsonpath='{range .status.parents[0].conditions[*]}{.type}={.status} {.reason}{"\n"}{end}'
Accepted=True Accepted
ResolvedRefs=False RefNotPermitted

The same rule covers TLS. A listener in one namespace that reads a Secret in another needs a ReferenceGrant in the Secret's namespace, with from set to the Gateway and to set to Secret.

Lineage note. 51-gateway.yaml is the Gateway-API alternative to the Traefik Ingress from ch.04 step 6. A running cluster uses exactly one. ch.06 (60-networkpolicy.yaml) restricts the controller-to-app edges with an allow rule that names the traefik namespace, which both stacks use.

How it works under the hood

The resource model and attachment

A controller advertises a controllerName. A GatewayClass points at that name; a Gateway references the GatewayClass and declares listeners (protocol/port/hostname/TLS). A route (HTTPRoute/TLSRoute/TCPRoute/…) attaches to a Gateway through parentRefs (optionally a specific listener via sectionName). The controller watches all of these plus the target Services/EndpointSlices and programs its proxy — same reconciliation idea as an ingress controller (ch.04), but the inputs are typed objects split by role. Route attachment is bidirectionally gated: the Gateway's allowedRoutes says which namespaces (Same, All, or a label Selector) and kinds may attach, and the route's hostnames must intersect the listener's hostname. A route must also name the Gateway in its parentRefs. Neither side can unilaterally bind.

Why it supersedes Ingress

  • Expressiveness as typed fields: header/method/query matching, traffic splitting by weight (native canary — no annotations, Part 07 ch.05), request/response header modification, URL rewrite/redirect, timeouts, mirroring — all schema-validated spec, rejected at apply if malformed (vs. Ingress annotations failing silently at the controller).
  • Portability: the Bookstore's rewrite is the core URLRewrite filter, identical across conformant implementations, where the ch.04 rewrite is a Traefik Middleware that only Traefik reads. Conformance is tested by the project, so behavior is consistent.
  • Role-oriented & RBAC-friendly: infra owns GatewayClass/Gateway; apps own routes. RBAC can grant a team HTTPRoute in their namespace without giving them control of the shared edge/TLS — impossible with single-object Ingress.
  • Multi-protocol: HTTPRoute and GRPCRoute (both GA), plus TLSRoute, TCPRoute and UDPRoute, which the v1.7.0 standard install registers as well (step 1). One model for L4 and L7. Ingress is HTTP-only. The CRDs carry a standard channel annotation, but Traefik's chart still gates TCP and TLS route support behind its experimentalChannel option. Check each implementation's docs before you rely on a route kind.
  • Observable status: Accepted, Programmed, ResolvedRefs conditions on Gateway and per-parentRef on routes — you can query whether routing is healthy instead of reading controller logs.

Status conditions

Gateway API leans on the standard status.conditions pattern (Part 00 ch.06). On a Gateway: Accepted (config valid/admitted), Programmed (data plane actually configured); per listener: Accepted, Programmed and ResolvedRefs (for example, the TLS Secret resolved). On an HTTPRoute, per attached parent: Accepted and ResolvedRefs (backends and filters resolved). ResolvedRefs=False on a route is the typical "my backend Service name or port is wrong, or it is cross-namespace and ungranted" signal: the route says so itself, which Ingress does not. Step 3 showed a refusal with Accepted=False and reason NotAllowedByListeners, and step 4 showed ResolvedRefs=False with reason RefNotPermitted.

Ingress → Gateway migration

  1. Install Gateway API CRDs + a controller (CRDs are not built in — omitting them is the #1 "kinds not found" error, exactly what a client dry-run shows without them).
  2. Infra: create GatewayClass + Gateway (listeners + TLS — reuse the existing TLS Secret, as the Bookstore does).
  3. App: translate each Ingress rule into HTTPRoute rules; replace annotation behaviors with typed filters (the Bookstore's Traefik Middleware → URLRewrite/ReplacePrefixMatch).
  4. Run in parallel on a test hostname, verify via status conditions + real requests, then cut traffic over and remove the Ingress (the Bookstore keeps both files only as teaching artifacts; never both live). Community tooling (e.g. ingress2gateway) automates step 3.

Production notes

In production: Gateway API is CRD-installed and controller-specific-in-practice. Pin CRD and controller versions, check the channel each CRD carries (gateway.networking.k8s.io/channel), and test CRD upgrades. A missing or too-old CRD makes every Gateway/HTTPRoute apply fail with no matches for kind "...", so the resources can't be registered or reconciled cluster-wide. Experimental kinds and fields come only from the experimental install, so a cluster that needs one must say so.

In production (EKS/GKE/AKS): managed Gateway implementations exist — GKE Gateway (Google Cloud Load Balancing), AWS Gateway API controller (VPC Lattice), Istio/Cilium/Envoy Gateway. The Gateway/HTTPRoute objects are portable; the GatewayClass/controllerName and some infra-policy extensions are implementation-specific. This portability of the app-facing objects is the core multi-cloud argument over annotation-bound Ingress.

In production: use the role split as a real security boundary. RBAC: platform team = GatewayClass/Gateway (+TLS Secrets); app teams = HTTPRoute in their namespace only. Gate attachment with the Gateway's allowedRoutes, and gate cross-namespace backends and certificates with ReferenceGrant, so no team can hijack the shared edge or reach another namespace's backend unapproved (Part 05 ch.01). The namespace label in step 3 is an approval, so no team's RBAC may set labels on its own namespace.

In production: list the namespaces the controller watches for Gateway routes in providers.kubernetesGateway.namespaces. The list narrows what Traefik routes, not its RBAC: the chart's ClusterRole still reads Secrets in every namespace. Keep the controller's namespace under the strictest policy you run. ch.04 covers that controller threat in full.

In production: gate on status conditions in automation. CI/CD and GitOps (Part 07 ch.04) should block promotion until Programmed=True / ResolvedRefs=True — a Gateway-API capability Ingress lacks; don't waste it by treating apply as success.

In production: Gateway API is the native home of weighted traffic splitting — progressive delivery without controller-specific canary annotations (Part 07 ch.05). If you do canaries, this is a strong reason to standardize on Gateway API over Ingress.

Quick Reference

kubectl get crd | grep gateway.networking.k8s.io          # CRDs installed? (must be)
kubectl get gatewayclass                                   # classes and their controllers
kubectl get gateway,httproute -n <NS>
kubectl describe gateway <GW> -n <NS>                       # listeners, conditions, events
kubectl get gateway <GW> -n <NS> \
  -o jsonpath='{range .status.conditions[*]}{.type}={.status}{"\n"}{end}'
kubectl get httproute <R> -n <NS> \
  -o jsonpath='{range .status.parents[0].conditions[*]}{.type}={.status}{"\n"}{end}'
kubectl get referencegrant -n <TARGET-NS>                   # consent, in the owner's namespace
# client dry-run REQUIRES the CRDs registered first (Gateway API is not built-in):
kubectl apply --dry-run=client -f <GATEWAY-MANIFEST>.yaml

Secure forms of the fields that carry the controls:

# Gateway listener: one HTTPS listener, a hostname, TLS ending at the Gateway,
# and attachment limited to the namespaces you name.
listeners:
  - name: https
    protocol: HTTPS
    port: <ENTRYPOINT-PORT>
    hostname: <HOST>
    tls:
      mode: Terminate
      certificateRefs:
        - kind: Secret
          name: <TLS-SECRET>
    allowedRoutes:
      namespaces:
        from: Same          # or Selector, on a label only the platform team sets
# HTTPRoute: attaches by name, claims a host, and sends typed rules to a Service.
parentRefs:
  - name: <GW>
hostnames:
  - <HOST>
rules:
  - matches:
      - path: { type: PathPrefix, value: /<PREFIX> }
    filters:
      - type: URLRewrite
        urlRewrite:
          path: { type: ReplacePrefixMatch, replacePrefixMatch: / }
    backendRefs:
      - name: <SVC>
        port: 80
# ReferenceGrant, in the namespace that owns the target: one source, one target.
from:
  - group: gateway.networking.k8s.io
    kind: HTTPRoute
    namespace: <SOURCE-NS>
to:
  - group: ""
    kind: Service
    name: <SVC>

Checklist:

  • Gateway API CRDs installed (standard channel, v1 kinds) and a controller whose GatewayClass controllerName matches it
  • Listener hostname set; allowedRoutes names the namespaces, and only the platform team can set the label a Selector uses
  • A ReferenceGrant in the target's namespace for each cross-namespace backend or certificate, scoped to one source and one name
  • Routing uses typed filters (not annotations) → portable
  • Automation gates on Accepted/Programmed/ResolvedRefs conditions
  • RBAC enforces the infra (Gateway) vs. app (HTTPRoute) role split
  • Not applied alongside the Ingress stack (mutually exclusive edge)

Test your understanding

Try each before opening the answer drawer. The act of trying is the exercise; the answer is the check.

  1. Explain the role split between Gateway and HTTPRoute and why it's a security improvement over a single-object Ingress with RBAC.

    Show answer `Gateway` (platform-owned) defines listeners, TLS, and *who may attach routes*: concentrated edge concerns. `HTTPRoute` (app-team-owned) declares per-team paths/filters/backends. RBAC can grant app teams HTTPRoute in their namespace *without* granting Gateway or TLS Secret access, which is impossible with Ingress where one object mixes both concerns. Route attachment is opt-in through the Gateway's `allowedRoutes`, and a cross-namespace backend or certificate is opt-in through `ReferenceGrant`, not implicit (see §Mental model and §Persona separation diagram).

  2. A teammate applies an HTTPRoute and sees status.parents[].conditions[]: Accepted=True but ResolvedRefs=False. What does this tell them, and what's the typical fix?

    Show answer The Gateway accepted the route attachment, but at least one `backendRefs` couldn't be resolved — typically a wrong Service name/port, the backend is in a different namespace without a `ReferenceGrant`, or the kind isn't supported. Fix: `kubectl describe httproute` to see the specific message; double-check Service exists in the same namespace (or add ReferenceGrant for cross-ns) and the port number matches the Service's `spec.ports[].port` (see §Status conditions).

  3. Your nginx.ingress.kubernetes.io/rewrite-target: /$2 annotation works perfectly on ingress-nginx. You're evaluating Cilium's Gateway implementation. Why is the Gateway API form (URLRewrite + ReplacePrefixMatch) a meaningful improvement here?

    Show answer The annotation is *string soup* — unvalidated, controller-specific, fails silently if misspelled, and unportable. `URLRewrite` is a schema-validated typed filter in the spec — `kubectl apply --dry-run=server` rejects malformed configs, the semantics are conformance-tested across implementations, and migrating to Cilium/Envoy Gateway/GKE Gateway keeps the same `HTTPRoute` yaml working. The forward-compatibility is real: this is the difference between a portable spec and per-vendor sugar (see §Why it supersedes Ingress).

  4. The Bookstore's Gateway and HTTPRoute are both in bookstore. A platform team moves the Gateway to a shared edge namespace and keeps the route in bookstore. What must change, and which object controls each part?

    Show answer Two things change. The route's `parentRefs` must name the Gateway's namespace, `namespace: edge`. Without it the route looks for the Gateway in its own namespace, never finds it, and never attaches. Attachment is the Gateway owner's decision: the `edge` Gateway's `allowedRoutes` must select the `bookstore` namespace, for example with a label selector, and the `bookstore` namespace must carry that label. No ReferenceGrant governs the attachment. The route's backends are Services in `bookstore`, and the route sits there too, so nothing crosses a namespace for them. The exception is the TLS Secret: if it stays in `bookstore` while the Gateway runs in `edge`, the `bookstore` namespace needs a ReferenceGrant from `Gateway` in `edge` to `Secret`. See the step 3 and step 4 sections.

  5. Hands-on extension: apply 51-gateway.yaml to a cluster without a Gateway controller. Read the Gateway's status. What do you observe, and what does it teach about CRDs versus controllers?

    What you should see The API server accepts the objects, because the CRDs validate them. Nothing reconciles them, so the Gateway's `Accepted` and `Programmed` conditions stay `Unknown` with the reason `Pending`. Captured on the lab, before Traefik was installed:
    {"conditions":[{"lastTransitionTime":"1970-01-01T00:00:00Z","message":"Waiting for controller","reason":"Pending","status":"Unknown","type":"Accepted"},{"lastTransitionTime":"1970-01-01T00:00:00Z","message":"Waiting for controller","reason":"Pending","status":"Unknown","type":"Programmed"}]}
    
    CRDs install the schema, and a controller that claims the GatewayClass's `controllerName` does the work. Both pieces are needed, as with an Ingress object and its controller (see step 1).

Further reading