Configure Kubernetes Gateway API with a GatewayClass, Gateway, and HTTPRoute for path-based routing with header-based traffic splitting across two backend services

domain: gateway-api.sigs.k8s.io · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Install a Gateway API-compatible controller such as Envoy Gateway or Contour and verify the GatewayClass is accepted by the controller by checking its status conditions
  2. Define a Gateway manifest referencing the GatewayClass and specifying listeners with protocol and port, and optionally attach TLS certificate references for HTTPS listeners
  3. Author HTTPRoute manifests in the application namespace with parentRefs pointing to the Gateway, and define rules with path match criteria and backendRefs listing the two Services with weights for traffic splitting
  4. Add header-based routing rules in a separate HTTPRoute rule using headers matches to route requests with specific header values to a canary backend independently of the weight-based split
  5. Apply the resources and verify routing behavior by sending test requests with and without the canary header and confirming traffic distribution matches the configured weights and header rules

Known gotchas

Related routes

Implement blue/green deployment on Kubernetes using Gateway API weighted HTTPRoute backendRefs
gateway-api.sigs.k8s.io · 5 steps · unrated
Define an Istio VirtualService and DestinationRule to implement header-based traffic routing between two versions of a service for A/B testing
istio.io · 6 steps · unrated
Deploy the OTel Collector as both a DaemonSet and a Deployment (gateway) on Kubernetes and understand the routing responsibilities of each tier
opentelemetry.io · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans