Manage traffic

Now we have a waypoint proxy installed, we will learn how to split traffic between services.

Split traffic between services

The Bookinfo application has three versions of the reviews service. You can split traffic between these versions to test new features or perform A/B testing.

Let’s configure traffic routing to send 90% of requests to reviews v1 and 10% to reviews v2:

  1. $ kubectl apply -f - <<EOF
  2. apiVersion: gateway.networking.k8s.io/v1
  3. kind: HTTPRoute
  4. metadata:
  5. name: reviews
  6. spec:
  7. parentRefs:
  8. - group: ""
  9. kind: Service
  10. name: reviews
  11. port: 9080
  12. rules:
  13. - backendRefs:
  14. - name: reviews-v1
  15. port: 9080
  16. weight: 90
  17. - name: reviews-v2
  18. port: 9080
  19. weight: 10
  20. EOF

To confirm that roughly 10% of the of the traffic from 100 requests goes to reviews-v2, you can run the following command:

  1. $ kubectl exec deploy/curl -- sh -c "for i in \$(seq 1 100); do curl -s http://productpage:9080/productpage | grep reviews-v.-; done"

You’ll notice the majority of requests go to reviews-v1. You can confirm the same if you open the Bookinfo application in your browser and refresh the page multiple times. Notice the requests from the reviews-v1 don’t have any stars, while the requests from reviews-v2 have black stars.

Next steps

This section concludes the Getting Started guide for ambient mode. You can continue to the Cleanup section to remove Istio or continue exploring the ambient mode user guides to learn more about Istio’s features and capabilities.