Skip to main content
Networking & service meshLesson 8 of 11

Service Mesh ② Splitting Traffic

Instead of releasing the new api version (v2) to everyone at once, send it to only 10% first. Follow how Istio's DestinationRule and VirtualService split traffic without changing app code.

Share to v1100%
Share to v2-
Who sees v2Nobody
web appCallerProxySplits hereistiodPushes rulesVirtualServiceWhere · what %DestinationRuleSubsets · connsapi v1Current versionapi v2New version100%
RequestAppears in a later step

What you will learn

  • Without rules, traffic splits by pod count
  • DestinationRule subsets name each version
  • How to do a canary release with VirtualService weight and header rules
  • Where connection limits, retries, and timeouts go
  • Rolling back just means changing the weights

Try it yourself​

kubectl get destinationrule api -o yaml # subsets, trafficPolicy (load balancing, connection limits)
kubectl get virtualservice api -o yaml # match (headers), route weight, retries, timeout
kubectl edit virtualservice api # Roll the weights back to 100 : 0
istioctl proxy-config routes deploy/web # Actual rules the web-side proxy received

Check yourself

  1. You start one v2 pod next to one v1 pod behind the api Service, with no DestinationRule or VirtualService. Where do requests go?
  2. A VirtualService sends 10% to subset v2, and there is only one v2 pod next to nine v1 pods. What share does v2 get?
  3. Errors rise on v2 during a 90 : 10 canary. What is the mesh way to roll back?

Further reading: Istio traffic management · VirtualService reference · DestinationRule reference · Zero-Downtime Deploys (Rolling Update)