← All notes

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

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

Sources

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

Permanent ID: iil:note:nambgfqk

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.},
}

Markdown

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.

All artifact files (JSON index)

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.