About this scenario
reviews in the shop namespace runs two Deployments behind one Service: reviews-v1 with 3 Pods and reviews-v2 with 1. The team wants a canary: 10% of requests on v2, and everyone who sends the header x-user-group: beta on v2 every time.
A teammate applied a DestinationRule with a v1 and a v2 subset and a VirtualService with the weights. Since then about one request in ten from productpage fails with a 503, and beta testers say they never see v2.
Fix both problems with Istio's own tools. Test with kubectl exec deploy/productpage -- curl -s http://reviews:8080/: the JSON says which version answered. istioctl analyze and the sidecar's access log (kubectl logs deploy/productpage -c istio-proxy) are good places to start.
Objectives
- Find what answers the 503s
- No request from productpage to reviews fails
- About 10% of requests reach v2
- Requests with `x-user-group: beta` always reach v2
- Both Deployments keep their replicas, and the VirtualService still does the split
What you'll practice
- A subset is a label selector inside a DestinationRule. A VirtualService routes to it by name, and Envoy builds one cluster per subset, named
outbound|PORT|SUBSET|HOST. - Envoy's response flag says which part failed.
UH means the cluster has no healthy endpoint, usually a subset whose labels match no Pod. NC means the cluster doesn't exist at all, usually a subset no DestinationRule defines. - HTTP routes are tried in order and the first match wins. A route without
match catches everything, so it belongs last. istioctl analyze flags the rules below it with IST0130. - Weights apply to requests, not Pods. With 3 v1 Pods and 1 v2 Pod, plain Kubernetes load balancing gives v2 25% of the traffic. The VirtualService gives it the 10% you asked for, whatever the replica counts.
- When you add a subset, apply the DestinationRule first and the VirtualService a few seconds later. In the other order, proxies briefly route to a cluster they don't have yet.
How the playground works
The cluster runs entirely in your browser: a simulated API server, scheduler, kubelets and controllers, with virtual nodes in three zones. kubectl output follows the real formats, errors use the real messages, and the add-ons (CSI storage, Traefik, Envoy Gateway, cert-manager, Helm, Flux, Argo CD, Kyverno, Cilium, Istio) behave like their real counterparts for the common paths. It's a simulation, so some behavior is simplified. Your progress is saved in this browser.