Traffic Shifting

    A common use case is to migrate traffic gradually from an older version of a microservice to a new one. In Istio, you accomplish this goal by configuring a sequence of routing rules that redirect a percentage of traffic from one destination to another.

    In this task, you will use send 50% of traffic to and 50% to reviews:v3. Then, you will complete the migration by sending 100% of traffic to reviews:v3.

    If you haven’t already applied destination rules, follow the instructions in Apply Default Destination Rules.

    1. To get started, run this command to route all traffic to the v1 version of each microservice.

    2. Open the Bookinfo site in your browser. The URL is http://$GATEWAY_URL/productpage, where $GATEWAY_URL is the External IP address of the ingress, as explained in the doc.

      Notice that the reviews part of the page displays with no rating stars, no matter how many times you refresh. This is because you configured Istio to route all traffic for the reviews service to the version and this version of the service does not access the star ratings service.

    3. Confirm the rule was replaced:

    4. Refresh the /productpage in your browser and you now see red colored star ratings approximately 50% of the time. This is because the v3 version of reviews accesses the star ratings service, but the version does not.

    5. Assuming you decide that the reviews:v3 microservice is stable, you can route 100% of the traffic to reviews:v3 by applying this virtual service:

      Zip

      Now when you refresh the /productpage you will always see book reviews with red colored star ratings for each review.

    In this task you migrated traffic from an old to new version of the service using Istio’s weighted routing feature. Note that this is very different than doing version migration using the deployment features of container orchestration platforms, which use instance scaling to manage the traffic.

    With Istio, you can allow the two versions of the reviews service to scale up and down independently, without affecting the traffic distribution between them.

    For more information about version routing with autoscaling, check out the blog article Canary Deployments using Istio.

    1. Remove the application routing rules: