Gateway API — next generation API for traffic routing in Kubernetes, replacing Ingress.
Ingress problems: scattered annotations, limited functionality, no native TCP/gRPC support.
Core resources:
Example:
1apiVersion: gateway.networking.k8s.io/v12kind: Gateway3metadata:4 name: my-gateway5 namespace: production6spec:7 gatewayClassName: istio8 listeners:9 - name: https10 protocol: HTTPS11 port: 44312 tls:13 mode: Terminate14 certificateRefs:15 - name: my-tls16 allowedRoutes:17 namespaces:18 from: Same19---20apiVersion: gateway.networking.k8s.io/v121kind: HTTPRoute22metadata:23 name: my-route24 namespace: production25spec:26 parentRefs:27 - name: my-gateway28 hostnames:29 - "myapp.com"30 rules:31 - matches:32 - path:33 type: PathPrefix34 value: /api35 backendRefs:36 - name: api-service37 port: 808038 - matches:39 - headers:40 - name: x-canary41 value: "true"42 backendRefs:43 - name: api-service-v244 port: 808045 filters:46 - type: RequestHeaderModifier47 requestHeaderModifier:48 add:49 - name: x-served-by50 value: canary
Advantages over Ingress: native TCP/gRPC support, role-oriented model, portable (works with any controller), built-in header-based routing support.