Kubernetes Gateway API - GatewayClass, Gateway and HTTPRoute instead of Ingress annotations
Answer: Define a Gateway that listens for HTTP traffic, then an HTTPRoute whose parentRefs list the Gateway and whose backendRefs list a Service and port. Gateway API is an add-on with API kinds for dynamic infrastructure provisioning and advanced traffic routing.
Example
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: example-gateway
namespace: example-namespace
spec:
gatewayClassName: example-class
listeners:
- name: http
protocol: HTTP
port: 80
hostname: "www.example.com"
allowedRoutes:
namespaces:
from: Same
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: example-httproute
namespace: example-namespace
spec:
parentRefs:
- name: example-gateway
hostnames:
- "www.example.com"
rules:
- matches:
- path:
type: PathPrefix
value: /login
backendRefs:
- name: example-svc
port: 8080
Stable kinds
| Kind | Defines | |---|---| | GatewayClass | a set of gateways with common configuration, managed by a controller that implements the class | | Gateway | an instance of traffic handling infrastructure, such as cloud load balancer | | HTTPRoute | HTTP rules for mapping traffic from a Gateway listener to backends, often a Service | | GRPCRoute | the same for gRPC, matching specific services and methods |
Rules
- A Gateway object is associated with exactly one GatewayClass, which names the controller that manages it.
- A Gateway accepts only same-namespace Routes unless
allowedRoutesis configured. - If
addressesis unspecified, the implementation's controller assigns an address or hostname. - Gateways supporting GRPCRoute must support HTTP/2 without an initial upgrade from HTTP/1.
- The specifications are custom resources supported by many implementations.
Why use it over Ingress
The kinds are role-oriented: infrastructure providers, cluster operators and application developers each manage their own objects. Header-based matching and traffic weighting were only possible in Ingress by using custom annotations.
See also
Claims
- id: C1 claim: A Gateway only accepts Routes from its own namespace by default. source: S2 evidence: "By default, a Gateway only accepts Routes from the same namespace."
- id: C2 claim: A Gateway is associated with exactly one GatewayClass. source: S2 evidence: "A Gateway object is associated with exactly one GatewayClass"
- id: C3 claim: Gateway API is an add-on. source: S1 evidence: "is an add-on containing API kinds"
Sources
- [S1] Gateway API. Kubernetes docs. https://kubernetes.io/docs/concepts/services-networking/gateway/ . License: CC-BY-4.0. Accessed 2026-11-18.
- [S2] gateway.md (source page). kubernetes/website (GitHub). https://github.com/kubernetes/website/blob/main/content/en/docs/concepts/services-networking/gateway.md . License: CC-BY-4.0. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Gateway API; kubernetes/website (GitHub), gateway.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Gateway API; kubernetes/website (GitHub), gateway.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors.
Cite this
iinventedlight. 2026. "Kubernetes Gateway API - GatewayClass, Gateway and HTTPRoute instead of Ingress annotations." iinventedlight Library, iil:note:nambgfqk, version of 2026-11-18. https://iinventedlight.com/library/notes/kubernetes-gateway-api/. License: CC-BY-4.0.
@misc{iil_note_nambgfqk,
author = {{iinventedlight}},
title = {{Kubernetes Gateway API - GatewayClass, Gateway and HTTPRoute instead of Ingress annotations}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/kubernetes-gateway-api/},
note = {Permanent ID iil:note:nambgfqk. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- kubernetes-gateway-api.table.json (table; CC-BY-4.0)
- kubernetes-gateway-api.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/kubernetes-gateway-api.md.