Container Service for Kubernetes (ACK) allows you to deploy Istio with a few clicks and supports multiple features of Istio. This topic describes the traffic routing, fault injection, and traffic shifting features of Istio, and how to implement intelligent routing by using Istio. An application from the official Istio website is used as an example in this topic.
Prerequisites
- Create a managed Kubernetes cluster.
- Deploy Istio.
Note The Istio version used in this example is 1.0.2.
- A local Linux environment is set up and you are connected to an ACK cluster by using kubectl. For more information, see Use kubectl to connect to an ACK cluster.
- The code of the Istio project in the preceding version is downloaded and you have run related commands in the Istio file directory. For more information, see Istio and intelligent routing.
Install the Bookinfo application
For more information about how to install the Bookinfo application, see Bookinfo Application.
Request routing
Three versions of the reviews service are deployed for the Bookinfo application. Therefore, you must set a default route for version routing. Otherwise, different versions of reviews (with or without star ratings) are presented each time you access the application. This occurs because no default route is set and Istio randomly routes requests to all available versions of the service.
Before you use Istio to control Bookinfo version routing, you must define the available versions in destination rules.
Run the following commands to create the default destination rule for the Bookinfo service:
- If you do not require mutual TLS authentication, run the following command:
kubectl apply -f samples/bookinfo/networking/destination-rule-all.yaml
- If you require mutual TLS authentication, run the following command:
kubectl apply -f samples/bookinfo/networking/destination-rule-all-mtls.yaml
Wait a few seconds for the destination rule to take effect. You can run the following command to view the destination rule:
kubectl get destinationrules -o yaml
Set the default version of all microservices to v1
Run the following command to set the default version of all microservices to v1:
kubectl apply -f samples/bookinfo/networking/virtual-service-all-v1.yaml
Run the following command to view all routing rules:
kubectl get virtualservices -o yaml
Routing rules are distributed to proxy servers in an asynchronous manner. You may need to wait for the routing rules to be synchronized to all pods. Wait a few seconds and then access the application.
Enter the URL http://{EXTERNAL-IP}/productpage
into the address bar of the browser to access the Bookinfo application.

Route requests from a specified user to reviews:v2
Run the following command to route requests from user jason to reviews:v2. This enables the ratings service.
kubectl apply -f samples/bookinfo/networking/virtual-service-reviews-test-v2.yaml
Run the following command to verify that the routing rule is created:
kubectl get virtualservice reviews -o yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
...
spec:
hosts:
- reviews
http:
- match:
- headers:
end-user:
exact: jason
route:
- destination:
host: reviews
subset: v2
- route:
- destination:
host: reviews
subset: v1
After you confirm that the routing rule is created, enter the URL http://{EXTERNAL-IP}/productpage
into the address bar of the browser to access the Bookinfo application.
jason
.

Inject faults
To test the resilience of the Bookinfo application, you can log on by using the jason account and inject a 7-second delay between the reviews:v2
and ratings
services. A 10-second connection timeout is set for the reviews:v2 service to call
the ratings service. Therefore, it is expected that the end-to-end connection has
no errors.
HTTP Delay
Use HTTP Delay to create a fault injection rule to set a delay for traffic transmission from user jason.
kubectl apply -f samples/bookinfo/networking/virtual-service-ratings-test-delay.yaml
After you verify that the rule is created, enter the URL http://{EXTERNAL-IP}/productpage
into the address bar of the browser to access the Bookinfo application.

HTTP Abort
Use HTTP Abort to create a fault injection rule.
kubectl apply -f samples/bookinfo/networking/virtual-service-ratings-test-abort.yaml
After you verify that the rule is created, enter the URL http://{EXTERNAL-IP}/productpage
into the address bar of the browser to access the Bookinfo application.
Log on by using the jason account. The following content is displayed.

Shift traffic
In addition to content-based routing, Istio also supports weighted routing rules.
Refresh the productpage page several times in the browser. You have a 50% opportunity to see reviews with red stars.
reviews:v3
service is stable, you can route 100% of the virtual service traffic to reviews:v3
. Run the following command to perform a canary release:kubectl replace -f samples/bookinfo/networking/virtual-service-reviews-v3.yaml
Summary
ACK allows you to deploy Istio, an open platform where you can connect, manage, and secure microservices. You can also integrate and configure multiple related services for applications. In the preceding example, the traffic routing, fault injection, and traffic shifting features of Istio are described by using an application from the official Istio website. You are welcomed to use ACK to deploy Istio as an open platform for managing microservices and integrate Istio into the project of the microservices.