Routing HTTP and canary traffic with Kubernetes Gateway API
After the ingress-nginx retirement, route HTTP paths, headers, and 80/20 canary weights with Kubernetes Gateway API and Envoy Gateway on a local kind cluster.
With the community
ingress-nginxcontroller retired in March 2026, Kubernetes Gateway API is the standard model for L7 HTTP routing. This guide installs Envoy Gateway on a 3-nodekindcluster, fixes the localLoadBalancer<pending>trap with anEnvoyProxyresource, and verifies path, header, and 80/20 weighted canary routing using a standardHTTPRoutewith zero vendor annotations.
All commands and outputs below were verified on a local 3-node
kindcluster on macOS (arm64) running Kubernetesv1.37.0,kubectl v1.36.1,helm v4.3.2, Envoy Gatewayv1.10.0(Gateway API CRD bundlev1.6.1, Envoydistroless-v1.40.2), and twonginx:1.27-alpinebackends.
Why Gateway API replaces Ingress NGINX
For years, Ingress paired with the community ingress-nginx controller served as the default entry point for HTTP traffic in Kubernetes. The Ingress spec itself only covered basic host and path matching, so teams had to rely on vendor-specific annotations like nginx.ingress.kubernetes.io/canary-weight for canary splits, header routing, or URL rewrites. Switching controllers meant rewriting those annotations, and putting cluster TLS settings and app routes in the same Ingress object blurred ownership between platform and app teams.
The community ingress-nginx controller reached official end-of-life (EOL) in March 2026. For new clusters and migrations, Kubernetes Gateway API replaces that single-resource model with three role-oriented layers. While L4 routing like Docker Swarm’s ingress routing mesh and VIP/DNSRR forwards traffic at the port level, Gateway API splits L7 HTTP control across three distinct owners:
- Infrastructure provider (
GatewayClass): Declares which controller implementation manages gateways (for example,gateway.envoyproxy.io/gatewayclass-controller). - Cluster operator (
Gateway): Owns listener ports, protocols, allowed route namespaces (allowedRoutes), and how the data plane is exposed. - Application developer (
HTTPRoute): Attaches to aGatewayviaparentRefsand defines path, header, and weighted traffic rules.
flowchart TD
GC["GatewayClass: eg<br/>(Infra provider)"]
GW["Gateway: eg-gateway<br/>(Cluster operator, HTTP 80)"]
HR["HTTPRoute: demo-route<br/>(App dev, 0 annotations)"]
V1["Service: backend-v1"]
V2["Service: backend-v2"]
GC -->|"Controller"| GW
GW -->|"allowedRoutes: Same"| HR
HR -->|"Path & 80% weight"| V1
HR -->|"Header & 20% weight"| V2
Because infrastructure exposure lives on Gateway, platform teams can change load-balancer settings without touching a single line of an application’s HTTPRoute.
Installing Envoy Gateway and Gateway API CRDs
Gateway API resources are installed as Custom Resource Definitions (CRDs) rather than built-in core objects. Installing the Envoy Gateway Helm chart deploys both the control plane and the standard Gateway API CRD bundle in one step.
1
2
3
4
5
6
7
8
helm upgrade --install eg oci://docker.io/envoyproxy/gateway-helm \
--kube-context kind-k8s-lab \
-n envoy-gateway-system \
--create-namespace \
--wait \
--timeout 180s
kubectl --context kind-k8s-lab get crd | grep gateway.networking.k8s.io
Checking the gateway.networking.k8s.io API group confirms that all 10 CRDs from bundle v1.6.1 are registered:
1
2
3
4
5
6
7
8
9
10
backendtlspolicies.gateway.networking.k8s.io Namespaced v1(storage),v1alpha3
gatewayclasses.gateway.networking.k8s.io Cluster v1(storage),v1beta1
gateways.gateway.networking.k8s.io Namespaced v1(storage),v1beta1
grpcroutes.gateway.networking.k8s.io Namespaced v1(storage)
httproutes.gateway.networking.k8s.io Namespaced v1(storage),v1beta1
listenersets.gateway.networking.k8s.io Namespaced v1(storage)
referencegrants.gateway.networking.k8s.io Namespaced v1,v1beta1(storage)
tcproutes.gateway.networking.k8s.io Namespaced v1(storage),v1alpha2
tlsroutes.gateway.networking.k8s.io Namespaced v1(storage),v1alpha2,v1alpha3
udproutes.gateway.networking.k8s.io Namespaced v1(storage),v1alpha2
Next, deploy two minimal nginx:1.27-alpine backends (backend-v1 and backend-v2) in a dedicated lab-d4-gateway namespace. Each backend mounts a ConfigMap that returns a plain-text version string (version=v1 or version=v2) for any path so routing results are unambiguous.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# 01-backends.yaml (excerpt for backend-v1; repeat with version=v2 for backend-v2)
apiVersion: v1
kind: Namespace
metadata:
name: lab-d4-gateway
---
apiVersion: v1
kind: ConfigMap
metadata:
name: backend-v1-conf
namespace: lab-d4-gateway
data:
default.conf: |
server {
listen 80;
location / {
default_type text/plain;
return 200 "version=v1\n";
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend-v1
namespace: lab-d4-gateway
spec:
replicas: 1
selector:
matchLabels:
app: backend
version: v1
template:
metadata:
labels:
app: backend
version: v1
spec:
containers:
- name: nginx
image: nginx:1.27-alpine
ports:
- containerPort: 80
volumeMounts:
- name: conf
mountPath: /etc/nginx/conf.d/default.conf
subPath: default.conf
volumes:
- name: conf
configMap:
name: backend-v1-conf
---
apiVersion: v1
kind: Service
metadata:
name: backend-v1
namespace: lab-d4-gateway
spec:
type: ClusterIP
selector:
app: backend
version: v1
ports:
- name: http
port: 80
targetPort: 80
Deploy the matching backend-v2 ConfigMap, Deployment, and Service, then wait for both rollouts to finish.
Fixing LoadBalancer Pending on local kind clusters
On managed cloud clusters, creating a GatewayClass and Gateway triggers the cloud controller to provision an external load balancer IP. On a local kind cluster without MetalLB, you hit a subtle snag.
Envoy Gateway creates the data-plane Envoy Service with type: LoadBalancer by default. Because kind leaves EXTERNAL-IP as <pending>, the Envoy proxy Pod (2/2 Running) and http listener (Programmed=True) come up healthy, yet the top-level Gateway stays stuck at PROGRAMMED=False with reason: AddressNotAssigned (No addresses have been assigned to the Gateway).
You can solve this cleanly by switching the data-plane Service to ClusterIP through an EnvoyProxy custom resource and referencing it from Gateway.spec.infrastructure.parametersRef.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 02-gateway.yaml
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
name: kind-clusterip-proxy
namespace: lab-d4-gateway
spec:
provider:
type: Kubernetes
kubernetes:
envoyService:
type: ClusterIP
---
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: eg
spec:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: eg-gateway
namespace: lab-d4-gateway
spec:
gatewayClassName: eg
infrastructure:
parametersRef:
group: gateway.envoyproxy.io
kind: EnvoyProxy
name: kind-clusterip-proxy
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: Same
Apply the manifest and wait for the Programmed=True condition:
1
2
3
4
kubectl --context kind-k8s-lab apply -f 02-gateway.yaml
kubectl --context kind-k8s-lab -n lab-d4-gateway wait gateway/eg-gateway \
--for=condition=Programmed=True --timeout=60s
kubectl --context kind-k8s-lab -n lab-d4-gateway get gateway
1
2
NAME CLASS ADDRESS PROGRAMMED AGE
eg-gateway eg 10.96.52.222 True 2m20s
The Gateway immediately receives the ClusterIP (10.96.52.222) and transitions to PROGRAMMED=True. Notice that changing how the proxy is exposed stays completely inside the infrastructure layer—no HTTPRoute changes are needed.
Standard HTTPRoute routing without vendor annotations
Now define a single HTTPRoute using only standard gateway.networking.k8s.io/v1 fields. There are zero vendor annotations in metadata.annotations, yet the manifest handles path routing, exact header matching, and an 80/20 weighted canary split.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 03-httproute.yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: demo-route
namespace: lab-d4-gateway
spec:
parentRefs:
- name: eg-gateway
rules:
- matches:
- path:
type: PathPrefix
value: /v1
backendRefs:
- name: backend-v1
port: 80
- matches:
- path:
type: PathPrefix
value: /v2
backendRefs:
- name: backend-v2
port: 80
- matches:
- path:
type: PathPrefix
value: /canary
headers:
- type: Exact
name: X-Canary
value: "true"
backendRefs:
- name: backend-v2
port: 80
- matches:
- path:
type: PathPrefix
value: /canary
backendRefs:
- name: backend-v1
port: 80
weight: 80
- name: backend-v2
port: 80
weight: 20
Once applied, demo-route reports Accepted=True and ResolvedRefs=True, and eg-gateway updates attachedRoutes to 1. Here is how Envoy evaluates incoming requests against these rules:
flowchart TD
REQ["HTTP Request<br/>(eg-gateway:80)"]
P1["/v1 or /v2"]
HDR["/canary +<br/>X-Canary: true"]
WGT["/canary<br/>(default weight)"]
V1["backend-v1"]
V2["backend-v2"]
REQ --> P1
REQ --> HDR
REQ --> WGT
P1 -->|"/v1"| V1
P1 -->|"/v2"| V2
HDR -->|"100% route"| V2
WGT -->|"weight: 80"| V1
WGT -->|"weight: 20"| V2
Gateway API precedence favors more specific matches. A /canary request carrying X-Canary: true always hits the third rule and goes straight to backend-v2, while requests to /canary without that header fall through to the 80/20 weighted split.
Forward a local port to the Envoy data-plane Service in envoy-gateway-system and run all three checks:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
ENVOY_SVC=$(kubectl --context kind-k8s-lab -n envoy-gateway-system get svc \
-l gateway.envoyproxy.io/owning-gateway-name=eg-gateway,gateway.envoyproxy.io/owning-gateway-namespace=lab-d4-gateway \
-o jsonpath='{.items[0].metadata.name}')
kubectl --context kind-k8s-lab -n envoy-gateway-system port-forward "svc/${ENVOY_SVC}" 18882:80 &
PF_PID=$!
curl -sS -w " [HTTP %{http_code}]\n" http://127.0.0.1:18882/v1
curl -sS -w " [HTTP %{http_code}]\n" http://127.0.0.1:18882/v2
curl -sS -w " [HTTP %{http_code}]\n" http://127.0.0.1:18882/unknown
for i in $(seq 1 10); do
curl -sS -H "X-Canary: true" http://127.0.0.1:18882/canary
done | sort | uniq -c
for i in $(seq 1 100); do
curl -sS http://127.0.0.1:18882/canary
done | sort | uniq -c
kill "$PF_PID"
Running this suite twice produced the following distribution:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
=== 1. Path-based routing (/v1, /v2, /unknown) ===
GET /v1 -> version=v1 [HTTP 200]
GET /v2 -> version=v2 [HTTP 200]
GET /unknown -> [HTTP 404]
=== 1b. Path-based consistency (5x each) ===
/v1 (5x):
5 version=v1
/v2 (5x):
5 version=v2
=== 2. Header-based routing (/canary + X-Canary: true, 10x) ===
10 version=v2
=== 3. Weighted canary routing (/canary without header, 100x) ===
# Run 1
80 version=v1
20 version=v2
# Run 2
81 version=v1
19 version=v2
Every rule matched the spec without a single vendor annotation: /v1 and /v2 routed consistently (5/5 each), unmatched /unknown returned 404, X-Canary: true pinned 10/10 requests to v2, and 100 plain /canary requests split 80:20 on the first run and 81:19 on the second.
Ingress vs. Gateway API and when to adopt
Here is how the two models compare when choosing a routing layer for a cluster:
| Dimension | Kubernetes Ingress | Kubernetes Gateway API |
|---|---|---|
| Role separation | Infra and app settings mixed in one object | Split across GatewayClass, Gateway, and HTTPRoute |
| Advanced routing | Controller-specific annotations | Native spec (headers, weight, filters) |
| Protocol coverage | HTTP/HTTPS only | HTTP, gRPC, TLS, TCP, UDP route CRDs |
| Portability | Annotations break when swapping controllers | Keep HTTPRoute, swap GatewayClass |
| Cross-namespace safety | Controller-dependent | Explicit allowedRoutes and ReferenceGrant |
| 2026 ecosystem status | Community ingress-nginx EOL (March 2026) | SIG-Network standard (Envoy Gateway, Cilium, Istio) |
You don’t need to migrate overnight if you already run an actively maintained non-ingress-nginx controller (such as Traefik or HAProxy) on a small cluster with simple host/path rules and no multi-team boundary requirements. However, if you still run community ingress-nginx, plan your migration now that security patches have stopped—and for any new cluster, starting on Gateway API avoids carrying legacy annotations forward.
Scope note: This test covered an HTTP (port 80) listener inside a single namespace (
allowedRoutes.namespaces.from: Same) accessed viaClusterIPandkubectl port-forward. TLS termination (HTTPS 443 +Secret), cross-namespace routing (ReferenceGrant), cloudLoadBalanceror MetalLB integration, andURLRewrite/RequestHeaderModifierfilters require separate verification.
Production caveats and checklist
Before promoting this setup beyond a local kind cluster, separate the local exposure override from your production manifests.
Warning: Do not deploy the
EnvoyProxy(type: ClusterIP)override andGateway.spec.infrastructure.parametersReffrom thekindexample to a cloud production cluster, or yourGatewaywon’t receive an external load balancer IP. DropparametersRefto use the defaultLoadBalancer, or point it to a productionEnvoyProxywith your cloud LB annotations.
Run through these four checks before rolling out Gateway API in production:
- Check existing CRD versions: If your cluster already runs Istio, Cilium, or another controller that ships Gateway API CRDs, verify version compatibility before installing a second chart.
- Watch status conditions, not just apply output: Confirm
Programmed=Trueon theGatewayand bothAccepted=TrueandResolvedRefs=Trueon everyHTTPRoute. - Keep namespace boundaries explicit: Stick with
allowedRoutes.namespaces.from: Sameby default, and add a minimalReferenceGrantin the target namespace only when cross-namespacebackendRefsare genuinely needed. - Verify canary precedence in CI: When combining header overrides and weighted splits on the same path, add automated
curlchecks for both header and non-header traffic after deployment.