Envoy Gateway and the Kubernetes Gateway API
Run Envoy as a K8s ingress / API gateway with declarative HTTPRoute / GRPCRoute / SecurityPolicy CRDs.
What Envoy Gateway is
Envoy Gateway is the upstream project that packages Envoy as a
Kubernetes ingress / API gateway, configured via the Kubernetes
Gateway API (gateway.networking.k8s.io). You install one controller;
it watches Gateway API resources and programs Envoy via xDS.
Why it exists:
- Ingress is too thin — no method matching, no header routing, no retries, no real TLS story.
- Direct xDS is too low-level for ingress teams.
- ingress-nginx is in maintenance mode and lacks gRPC, JWT, and rich retry support.
Gateway API is the K8s sig-network successor to Ingress, designed by Google, F5, Solo, and the Istio team to be vendor-neutral. Envoy Gateway is the reference implementation that runs vanilla upstream Envoy.
The four resources you'll touch
| Resource | What it does |
|---|---|
GatewayClass | Selects which controller programs the gateway |
Gateway | Declares listeners (port, protocol, TLS) |
HTTPRoute / GRPCRoute | Match → backendRefs (with weights) |
SecurityPolicy / BackendTrafficPolicy | Envoy-specific extensions (auth, rate-limit, timeouts, retries) |
A complete minimal stack
# 1. GatewayClass — pick the controller
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata: { name: eg }
spec:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
---
# 2. Gateway — listener + TLS
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata: { name: edge, namespace: web }
spec:
gatewayClassName: eg
listeners:
- name: https
port: 443
protocol: HTTPS
tls:
mode: Terminate
certificateRefs:
- { kind: Secret, name: edge-tls }
allowedRoutes:
namespaces: { from: All } # see pitfall below
---
# 3. HTTPRoute — /api -> two backends, 90/10 canary
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata: { name: api, namespace: app }
spec:
parentRefs:
- { name: edge, namespace: web }
hostnames: ["api.example.com"]
rules:
- matches:
- path: { type: PathPrefix, value: /api }
backendRefs:
- { name: api-svc, port: 8080, weight: 90 }
- { name: api-canary, port: 8080, weight: 10 }
timeouts: { request: 5s }
retry: { codes: [502, 503], attempts: 3, backoff: 100ms }
Install the controller:
helm install eg oci://docker.io/envoyproxy/gateway-helm \
--version v1.2.0 \
-n envoy-gateway-system --create-namespace
Three onboarding traps
An HTTPRoute in namespace app referencing a Gateway in
namespace web is silently ignored unless the Gateway opts
in via from: All or a label selector. The route shows
Accepted=False in its status — always
kubectl describe httproute first.
Cross-namespace secret refs require a ReferenceGrant.
Cert-manager users hit this constantly: they put the
Certificate in the cert-manager namespace and
the Gateway in web, then wonder why the
listener is Programmed=False.
Rate limit, JWT auth, WASM, and ext_proc are not part of
Gateway API itself. Envoy Gateway adds them via
SecurityPolicy, BackendTrafficPolicy, and
EnvoyExtensionPolicy. Teams migrating from Istio expect
annotations and find none — you write a policy CR that targets the
route via targetRefs.
Adding JWT auth via SecurityPolicy
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: SecurityPolicy
metadata: { name: api-jwt, namespace: app }
spec:
targetRefs:
- { group: gateway.networking.k8s.io, kind: HTTPRoute, name: api }
jwt:
providers:
- name: idp
issuer: https://auth.example.com/
audiences: ["api"]
remoteJWKS: { uri: https://auth.example.com/.well-known/jwks.json }
That single CR generates the same jwt_authn filter you'd write by
hand in Lesson 19 — but applied to the right HTTPRoute via
targetRefs.
vs Istio Gateway
Istio Gateway is the older, mesh-coupled API
(networking.istio.io/v1beta1). Powerful, but ties you to Istio's
control plane and CRDs.
Envoy Gateway is mesh-agnostic, uses standard Gateway API resources that work the same on Kong, Cilium, Contour, and HAProxy controllers, and ships a stripped-down focused control plane.
For pure ingress (no mesh), Envoy Gateway is becoming the default — and it's why teams are migrating off ingress-nginx, which is in maintenance mode.
Hands-on: from zero to JWT-protected canary in one cluster
- Spin up kind:
kind create cluster --name eg-demo
-
Install Envoy Gateway with Helm (command above).
-
Apply the three core manifests (GatewayClass + Gateway + HTTPRoute). Then:
kubectl get gateway,httproute -A
Confirm Programmed=True on the Gateway and
Accepted=True on the route.
- Port-forward and test the canary:
kubectl -n envoy-gateway-system port-forward svc/envoy-web-edge 8443:443
curl -k --resolve api.example.com:8443:127.0.0.1 https://api.example.com:8443/api
- Add the SecurityPolicy from above. Without a token, you should now get 401:
curl -k -i --resolve api.example.com:8443:127.0.0.1 \
https://api.example.com:8443/api
# expect: HTTP/2 401
- Tear down:
kind delete cluster --name eg-demo.
You finished the deep dive
Module 7 in one breath:
- WASM — custom filter logic, near-native, sandboxed.
- Lua — quick scripts, no toolchain.
- ext_proc — bidirectional body mutation via gRPC. AI/PII work goes here.
- Dynamic forward proxy — egress to anywhere with one cluster.
- SDS — TLS cert rotation without restarts.
- Outlier detection — passive health checks that actually work, if you avoid the panic-threshold trap.
- Envoy Gateway — Envoy as a Kubernetes ingress / API gateway, declarative.
Combined with Modules 1-6, you now have a deeper-than-the-official-docs understanding of Envoy. Go ship something.
An HTTPRoute in namespace 'app' references a Gateway in namespace 'web' and shows Accepted=False. Most likely cause?