Lesson 12 of 13 · Running it
Operating gateways
Run the gateway as critical shared infrastructure. Read Envoy access logs and their response flags (real examples for no route, rate limited, JWT missing, timeout, retries exhausted, missing backend), which metrics and traces to collect per route, a field guide for 4xx and 5xx errors, how to roll out gateway configuration and upgrades safely, and how to size and scale gateway pods.
A shared, critical component
Every external request goes through the gateway, so it's both the best place to see problems and the place where one mistake affects everyone. Operate it like a product: observability, safe changes, capacity and upgrades.
The school's front office logs every visitor: name, time, which room, and why someone was turned away ("no appointment", "too many visitors today", "teacher didn't answer"). When a parent complains, the office looks up the log instead of guessing.
Access logs: the first tool
Envoy Gateway writes JSON access logs from the gateway pods. A rate-limited request in the lab (real):
{
"start_time": "2026-11-08T18:11:07.548Z",
"method": "GET",
":authority": "api.example.test",
"x-envoy-origin-path": "/orders",
"response_code": 429,
"response_code_details": "request_rate_limited",
"response_flags": "RL",
"route_name": "httproute/shop/orders/rule/1/match/0/api_example_test",
"upstream_cluster": "httproute/shop/orders/rule/1",
"duration": 1,
"x-request-id": "732026fb-a7dc-4f7e-9372-c17323ea10fe"
}
The route_name tells you which HTTPRoute, rule and match handled it; x-request-id links it to backend logs and traces.
Real lines from the lab for different failures (code, flags, details, path):
200 - via_upstream /orders ← normal: the backend answered
429 RL request_rate_limited /orders ← lesson 6
401 - jwt_authn_access_denied{Jwt_is_missing} /orders ← lesson 5: no token
504 UT upstream_per_try_timeout /delay/3 ← lesson 7: per-try timeout
503 URX via_upstream /status/503 ← retries exhausted; last attempt's 503
500 - direct_response /payments ← route exists, backend Service missing
404 NR route_not_found / ← no route for this host/path
# Gateway pod logs (one deployment per Gateway)
D=$(kubectl get deploy -n envoy-gateway-system \
-l gateway.envoyproxy.io/owning-gateway-name=edge -o jsonpath='{.items[0].metadata.name}')
kubectl logs -n envoy-gateway-system deploy/$D -c envoy --tail=100 \
| jq -r 'select(.response_code >= 400) | "\(.response_code) \(.response_flags) \(.response_code_details) \(.":authority") \(."x-envoy-origin-path")"'
4xx and 5xx field guide
| Symptom | Likely cause | Check |
|---|---|---|
404 NR |
Host or path not routed; route attached to another listener; wrong Host |
Route hostnames, matches, parentRefs, sectionName, route status |
401 jwt_authn_access_denied{...} |
Missing, expired or wrong-audience token | Token claims, iss/aud, JWKS reachability |
| 403 | Authorization rule, IP rule, WAF block, ext_authz denied | Policy configuration, WAF logs |
429 RL |
Rate limit reached | Which rule and key; is the client retrying too fast? |
500 direct_response |
Route rule with no valid backend | Route ResolvedRefs condition |
| 502 | Backend reset the connection or sent an invalid response; protocol mismatch (HTTP vs HTTPS, HTTP/2) | Backend logs, port and protocol, appProtocol |
503 UH |
No ready endpoints | kubectl get endpointslices, readiness probes |
503 UF / UO |
Connection failure / circuit breaker overflow | Backend capacity, circuit-breaker limits |
504 UT |
Backend too slow for the timeout | Backend latency; timeout chain (lesson 7) |
Then confirm the controller accepted your configuration: kubectl get gateway,httproute -A and the controller's own logs for translation errors.
Metrics and traces
Collect per route (and per tenant or consumer where cardinality allows):
- Rate: requests per second.
- Errors: 4xx and 5xx separately (4xx often means clients or policy; 5xx means you).
- Duration: p50, p95, p99 latency, and upstream time vs gateway time.
- Saturation: active connections, pending requests, CPU and memory of gateway pods.
- Policy outcomes: rate-limited, auth-rejected, WAF-blocked counts.
Envoy exposes Prometheus metrics; Envoy Gateway can also export metrics and traces via OpenTelemetry. Make the gateway start the trace (or continue the client's traceparent), so every backend span hangs under the gateway's span. Alerts should be on SLOs per API (error rate, latency), not on single pod restarts.
Changing configuration safely
- Gateway configuration (routes, policies, WAF rules, certificates) lives in Git and goes through review and CI: schema validation, policy tests,
kubectl apply --dry-run=server. - Roll changes through environments, and for shared gateways, through rings (internal APIs first).
- Route ownership limits blast radius: app teams change their own routes; platform-wide policies need platform review.
- Watch the error dashboards for 15 minutes after each change; know how to revert (Git revert, Argo CD rollback).
Upgrades and capacity
- Upgrade the controller and Envoy regularly (security fixes); read release notes for API and default changes; upgrade a non-production gateway first.
- Gateway API CRD upgrades affect every implementation in the cluster; coordinate them.
- Run at least two (better three) gateway replicas across zones, with a PodDisruptionBudget, and graceful draining on shutdown so in-flight requests finish.
- Autoscale on CPU or connections; load-test to know requests per second per pod for your mix of TLS, JWT checks and rate-limit calls.
- Separate gateways for very different traffic (public, partner, internal) so a flood on one doesn't starve the others.
Try it
- In the lab cluster, produce each line of the field guide on purpose (no token, wrong host, missing Service, slow backend, scale a backend to zero) and find its access-log line.
- Scale
orders-v1to 0 replicas while the route still sends it 90% of traffic. Which code and flag do clients get? - Write the alert rules you'd want for one API: what threshold, over what window, who gets paged.
- Upgrade Envoy Gateway's Helm release to the same version with one changed value, and watch whether existing connections are dropped during the rollout.
Going deeper
- Use response flags in dashboards: a spike in
UHmeans backends lost readiness; a spike inRLmay be a misbehaving client or a limit set too low. - Shadow config testing: render the new configuration and run synthetic requests against a staging gateway before production.
- Keep a runbook per common failure, linked from the alert.
Recap
- Access logs with response flags and details explain most gateway errors quickly:
NR,RL,UT,URX,UH,UF, JWT denials, direct responses. - Collect rate, errors, duration and saturation per route; start traces at the gateway.
- Treat gateway configuration as code with reviews, CI checks and rings.
- Run several replicas across zones with PDBs, graceful draining, autoscaling and regular upgrades.
This site is a public version of my personal engineering knowledge hub. It intentionally excludes confidential company information and internal operational details.