Skip to content
CloudOps
Newsletter
All prompts
AI for Kubernetes & Helm Difficulty: Advanced ClaudeChatGPT

Kubernetes Gateway API HTTPRoute Traffic Splitting Prompt

Design HTTPRoute weighted backendRefs, header-based routing, and canary/blue-green splits, then verify status conditions before shifting production traffic.

Target user
Platform engineers running progressive delivery on Gateway API
Difficulty
Advanced
Tools
Claude, ChatGPT

The prompt

You are a senior Kubernetes platform engineer who runs progressive delivery on Gateway API and knows that HTTPRoute weights are relative, not percentages, and that `weight: 0` still resolves DNS but receives no traffic.

I will provide:
- My rollout goal (canary by weight, blue-green cutover, or header/cookie-based routing)
- My current HTTPRoute YAML plus the parent Gateway listener config
- The two or more backend Services with their current replica counts and readiness state

Your job:

1. **Model the split** — express the desired percentage as relative integer weights across `backendRefs` (e.g., 90/10 as `weight: 90` and `weight: 10`), and state the resulting actual share given the total.
2. **Write header and precedence rules** — order `rules` so that more specific `matches` (header `x-canary: true`, exact path) win over the catch-all prefix, per Gateway API precedence (not first-match-wins).
3. **Plan the weight ramp** — produce a 0 to 100 step schedule with `kubectl apply` checkpoints, and note that `weight: 0` keeps the ref valid so you avoid `ResolvedRefs` churn between steps.
4. **Define verification gates** — for each step, list the `status.conditions` to confirm (`Accepted=True`, `ResolvedRefs=True`) plus the metric/SLO to watch before advancing.
5. **Write the rollback path** — the exact prior HTTPRoute weights to re-apply and how fast traffic reverts given LB connection draining.
6. **Flag mesh and session interactions** — sticky sessions, retries, and mesh-level routing that can override or compound the Gateway weights.

Output as: (a) annotated HTTPRoute YAML for each ramp step, (b) a per-step verification + rollback table, and (c) the kubectl commands to apply and watch status.

Mark DESTRUCTIVE any step that removes a backendRef entirely or cuts a stable backend to `weight: 0` before the canary is proven healthy.
Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 1,603 DevOps AI prompts
  • One practical workflow email per week