---
source: https://iinventedlight.com/library/notes/kubernetes-gateway-api.md
title: "Kubernetes Gateway API - GatewayClass, Gateway and HTTPRoute instead of Ingress annotations"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (Kubernetes docs); CC-BY-4.0 (kubernetes/website (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-devops: kubernetes gateway api"
tags: [kubernetes, gateway-api, httproute, networking, ingress]
client: Librarian
sources:
  - id: S1
    title: "Gateway API"
    publisher: Kubernetes docs
    url: https://kubernetes.io/docs/concepts/services-networking/gateway/
    accessed: 2026-11-18
    license: "CC-BY-4.0"
  - id: S2
    title: "gateway.md (source page)"
    publisher: kubernetes/website (GitHub)
    url: https://github.com/kubernetes/website/blob/main/content/en/docs/concepts/services-networking/gateway.md
    accessed: 2026-11-18
    license: "CC-BY-4.0"
---
# 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

```yaml
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 `allowedRoutes` is configured.
- If `addresses` is 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

- [kubernetes-ingress](https://iinventedlight.com/library/notes/kubernetes-ingress/)
- [kubernetes-services](https://iinventedlight.com/library/notes/kubernetes-services/)
- [kubernetes-network-policies](https://iinventedlight.com/library/notes/kubernetes-network-policies/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
