Continental Innovates with Rancher and Kubernetes
A central advantage of traffic management in Istio is that it allows dynamic request routing. Some common applications for dynamic request routing include canary deployments and blue/green deployments. The two key resources in Istio traffic management are virtual services and destination rules.
This section describes how to add an example virtual service that corresponds to the reviews microservice in the sample BookInfo app. The purpose of this service is to divide traffic between two versions of the reviews service.
reviews
In this example, we take the traffic to the reviews service and intercept it so that 50 percent of it goes to v1 of the service and 50 percent goes to v2.
v1
v2
After this virtual service is deployed, we will generate traffic and see from the Kiali visualization that traffic is being routed evenly between the two versions of the service.
To deploy the virtual service and destination rules for the reviews service,
apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: reviews spec: hosts: - reviews http: - route: - destination: host: reviews subset: v1 weight: 50 - destination: host: reviews subset: v3 weight: 50 --- apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata: name: reviews spec: host: reviews subsets: - name: v1 labels: version: v1 - name: v2 labels: version: v2 - name: v3 labels: version: v3
Result: When you generate traffic to this service (for example, by refreshing the ingress gateway URL), the Kiali traffic graph will reflect that traffic to the reviews service is divided evenly between v1 and v3.
v3