A Gateway is part of the new Kubernetes Gateway API, offering more extensibility and protocol support than Kubernetes Ingress. It works at Layer 4–7.

🚪 Purpose

  • Modular, extensible traffic routing
  • Supports multiple protocols: HTTP, HTTPS, TCP, gRPC
  • Separates infrastructure (Gateway) from policy (Routes)

📦 Components

  • GatewayClass: Defines the controller/implementation
  • Gateway: Specifies ports, listeners, and IPs
  • HTTPRoute, TCPRoute, TLSRoute: Define traffic rules
flowchart TD

  client[Client]

  gateway[Gateway Listener]

  route1[HTTPRoute<br/>api.example.com]
  route2[HTTPRoute<br/>app.example.com]
  
  svcA[Service A]
  svcB[Service B]

  client --> gateway
  gateway --> route1
  gateway --> route2
  route1 --> svcA
  route2 --> svcB

  style gateway fill:#aff,stroke:#333,stroke-width:2px
  style route1 fill:#ddf,stroke:#333
  style route2 fill:#ddf,stroke:#333
  style svcA fill:#bbf,stroke:#333
  style svcB fill:#bbf,stroke:#333

🔧 Example

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: my-gateway
spec:
  gatewayClassName: nginx-internal
  listeners:
    - name: http
      port: 80
      protocol: HTTP
      allowedRoutes:
        namespaces:
          from: Same

See also: https://istio.io/latest/docs/reference/config/networking/gateway/