Skip to main content
Course/Storage & Ingress/Gateway API β€” Next-Generation Ingress
7/760 min
Storage & Ingress

Gateway API β€” Next-Generation Ingress

Replace classic Ingress with the role-oriented Gateway API: GatewayClass, Gateway, and HTTPRoute.

intermediate60 minRead β†’ Lab β†’ Quiz β†’ Practice
🧠 Brain Warm-Up
🧠 Brain Warm-Up: Classic Kubernetes Ingress routes HTTP traffic, but it has no standard way to split traffic 90/10 between two backends, or route based on HTTP headers. Why do you think that is β€” and what would you need to add to the API to support it? Think before reading.

Why Gateway API Exists

Classic Ingress was designed for a simple use case: route HTTP hostnames to Services. As teams tried to do more β€” canary deployments, header-based routing, gRPC, TCP β€” they discovered that Ingress annotations were the only escape hatch. Every controller (nginx, traefik, haproxy) invented its own annotation namespace, making configs non-portable.

Gateway API (GA since Kubernetes 1.28) solves this with a structured, role-oriented API that is expressive enough to cover these use cases without annotations.

Resource Hierarchy

Cluster-scoped:
  GatewayClass  ←── names the controller (e.g. nginx, istio, cilium)

Namespace-scoped:
  Gateway       ←── defines listeners: protocol (HTTP/HTTPS/TCP) + port
    └── HTTPRoute ←── defines routing rules β†’ backend Services

Role Separation

ResourceOwnerScope
GatewayClassInfrastructure adminCluster
GatewayInfrastructure adminNamespace
HTTPRouteApplication developerNamespace

This separation means app developers can attach routes to a shared Gateway without needing cluster-admin privileges β€” a major improvement over Ingress.

Ingress vs Gateway API Comparison

FeatureIngressGateway API
Traffic splittingAnnotation-only (non-standard)weight field in HTTPRoute
Header routingAnnotation-onlymatches.headers in HTTPRoute
TCP/gRPCNot standardTCPRoute / GRPCRoute
Role separationNoneGatewayClass / Gateway / Route
Multi-controllerOne controller per IngressMultiple Gateways per class

HTTPRoute Key Fields

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: my-route
spec:
  parentRefs:          # which Gateway(s) to attach to
    - name: my-gateway
      namespace: default
  hostnames:           # replaces Ingress host
    - "app.example.com"
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /api
      backendRefs:     # where to send traffic
        - name: api-service
          port: 8080
          weight: 90
        - name: api-service-v2
          port: 8080
          weight: 10

The weight field enables canary deployments natively β€” no annotations needed.