Gateway trust and traffic policy
Separate two cross-namespace permissions
Attachment to a Gateway is governed by the listener allowedRoutes configuration. A cross-namespace backend or certificate reference instead requires permission from the referenced namespace, expressed using ReferenceGrant. The following grant permits HTTPRoutes from bm-app51 to refer to only the catalog-v2 Service in bm-backend51. It does not select one specific source route name; namespace-level trust matters. It does not grant network access, Kubernetes RBAC or end-user authorization. If no grant exists, the foreign reference is invalid; the controller must not silently forward it.
apiVersion: gateway.networking.k8s.io/v1kind: ReferenceGrantmetadata: name: catalog-v2-from-app namespace: bm-backend51spec: from: - group: gateway.networking.k8s.io kind: HTTPRoute namespace: bm-app51 to: - group: "" kind: Service name: catalog-v2Calculate a rollout without guessing results
The route uses weights 9 and 1, corresponding to desired relative shares 9/10 and 1/10. Changing them to 1 and 0 removes the second backend from weighted selection, but may not terminate already in-flight requests. A bad reference is not an invitation to silently redistribute all its share. Verify the implementation’s invalid-reference behavior; for HTTPRoute a selected invalid backend share should generate an error rather than secretly becoming successful traffic. Use health, error and latency gates, a sufficient bounded sample, and response markers for each version.
backendRefs:- name: catalog-v1 port: 8080 weight: 1- name: catalog-v2 namespace: bm-backend51 port: 8080 weight: 0Treat TLS as two independent links
The listener terminates client TLS using a hostname-matching certificate in the Gateway namespace. The Services below are private and do not imply encrypted upstream traffic. For HTTPS to an upstream, investigate BackendTLSPolicy with the exact installed release and ensure server name and CA trust match. Implementation policies such as Gateway Fabric UpstreamSettingsPolicy and AccessPolicy have their own versions and attachment rules; they are not portable Gateway API fields. Do not deploy unsupported policy YAML or weaken certificate verification.
apiVersion: v1kind: Servicemetadata: name: catalog-v1 namespace: bm-app51spec: type: ClusterIP selector: {app: catalog-v1} ports: - port: 8080 targetPort: 8080---apiVersion: v1kind: Servicemetadata: name: catalog-v2 namespace: bm-backend51spec: type: ClusterIP selector: {app: catalog-v2} ports: - port: 8080 targetPort: 8080Make rollback a verifiable change
Record the known-good route, listener, certificate identity, private data-plane exposure, backend ownership and conditions. Stop a rollout when errors, auth failures or latency cross a preapproved gate. Restore the last reviewed route spec, wait for current generation conditions and verify real requests. Revoking a grant is a security change, not a substitute for traffic rollback. Do not remove shared Gateways, classes or Secrets to undo one route. Work offline with the supplied fixture; a live extension requires separate authorization and an approved isolated cluster.
Review → apply reviewed route only → confirm current status → probe intended and denied pathsRollback → restore prior route spec → verify conditions and responses → record residual issuesPractice and next steps
Practice: Use grant.yaml and route.yaml. Explain the two trust checks, compute relative shares, then propose a stable-only rollback and verification gate. Use the staged manual exercise; no live deployment is required.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Gateway trust and traffic policy
Assess Gateway API design and operational reasoning.
Who grants access to the foreign Service?
What does the grant NOT provide?
What share does weight 1 get against weight 9?
Does listener TLS encrypt upstream traffic automatically?
What is a safe rollback?