Istio is an open source service mesh that provides traffic management, observability, security, and policy capabilities. When integrated with Kubernetes, Istio helps you manage and control container applications while improving performance, security, and reliability. This topic uses the Bookinfo sample application to demonstrate how to use Istio in a self-managed Kubernetes cluster connected to Elastic Container Instance through a VNode.
Background information
Istio is an open source service mesh platform that manages traffic between microservices and handles network communications and security risks. Integrated with Kubernetes, Istio provides standardized, secure traffic management and simplifies deployment and O&M.
Bookinfo simulates a single catalog entry of an online bookstore, displaying book descriptions, details such as ISBN and page count, and reader reviews. Bookinfo is a heterogeneous application composed of four microservices written in different languages, making it ideal for demonstrating Istio features. The end-to-end architecture of Bookinfo:

-
Productpage: a Python microservice that calls the Details and Reviews microservices to generate a page. It provides the logon and logoff features.
-
Details: a Ruby microservice that contains book information.
-
Reviews: a Java microservice that contains book reviews. It has the following three versions:
-
Version 1, which does not call the Ratings microservice.
-
Version 2, which calls the Ratings microservice and rates a book by using one to five black stars.
-
Version 3, which calls the Ratings microservice and rates a book by using one to five red stars.
-
-
Ratings: a Node.js microservice that provides ratings based on book reviews.
For more information, visit Istio.
Prerequisites
This topic applies to self-managed Kubernetes clusters. Make sure that your cluster meets the following conditions:
-
A VNode is deployed in the self-managed Kubernetes cluster.
-
If the self-managed Kubernetes cluster is deployed in a data center, the data center is connected to Alibaba Cloud.
-
If the self-managed Kubernetes cluster is deployed on an Elastic Compute Service (ECS) instance and the network plug-in is Flannel, make sure that the Kubernetes cloud control manager (CCM) is deployed in the cluster. This ensures that Elastic Container Instance is interconnected with the pods on real nodes. For more information, see Deploy the CCM.
Preparations
-
Install Istio. For more information, see Getting Started.
-
Create a namespace and configure labels for the namespace.
kubectl create namespace istio-test kubectl label namespace istio-test istio-injection=enabled
Procedure
Deploy the Bookinfo application
-
Create a file named bookinfo.yaml and copy the following template into the file:
NoteIn the following YAML sample code, nodeSelectors are added to schedule pods to VNodes. You can also configure eci-profile to schedule pods to VNodes. For more information, see Schedule pods to a VNode and Use eci-profile to schedule pods to a VNode.
-
Deploy the Bookinfo application.
kubectl -n istio-test apply -f bookinfo.yamlThe following command output is returned:
xxx# kubectl -n istio-test apply -f bookinfo.yaml service/details created serviceaccount/bookinfo-details created deployment.apps/details-v1 created service/ratings created serviceaccount/bookinfo-ratings created deployment.apps/ratings-v1 created service/reviews created serviceaccount/bookinfo-reviews created deployment.apps/reviews-v1 created deployment.apps/reviews-v2 created deployment.apps/reviews-v3 created service/productpage created serviceaccount/bookinfo-productpage created deployment.apps/productpage-v1 created -
View the status of Bookinfo.
kubectl -n istio-test get pods -o wideThe following command output is returned:
[xxx@xxx ~]# kubectl -n istio-test get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES details-v1-5f957dd5ff-kdvpc 2/2 Running 0 14m 192.168.xxx cn-qingdao.vnd-m5echu4xxx <none> <none> productpage-v1-85976f8df7-ht5dg 2/2 Running 0 72s 192.168.xxx cn-qingdao.vnd-m5echu4xxx <none> <none> ratings-v1-69fb6864cf-9l7fp 2/2 Running 0 23m 192.168.xxx cn-qingdao.vnd-m5echu4xxx <none> <none> reviews-v1-77f77b5-sssgw 2/2 Running 0 7m13s 192.168.xxx cn-qingdao.vnd-m5echu4xxx <none> <none> reviews-v2-5b9b5676c-bcjx9 2/2 Running 0 23m 192.168.xxx cn-qingdao.vnd-m5echu4xxx <none> <none> reviews-v3-6ff46dbb9c-kf2gl 2/2 Running 0 13m 192.168.xxx cn-qingdao.vnd-m5echu4xxx <none> <none> -
Check the microservices of Bookinfo.
kubectl -n istio-test get servicesThe following command output is returned:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE details ClusterIP 10.96.1.xxx <none> 9080/TCP 25m productpage ClusterIP 10.96.2.xxx <none> 9080/TCP 25m ratings ClusterIP 10.96.1.xxx <none> 9080/TCP 25m reviews ClusterIP 10.96.1.xxx <none> 9080/TCP 25m
Deploy an Istio gateway
-
Create a file named bookinfo-gateway.yaml and copy the following template into the file:
-
Deploy an Istio gateway.
kubectl -n istio-test apply -f bookinfo-gateway.yamlExpected output:
[root@xxx ~]# kubectl -n istio-test apply -f bookinfo-gateway.yaml gateway.networking.istio.io/bookinfo-gateway created virtualservice.networking.istio.io/bookinfo created -
View the Istio gateway.
kubectl -n istio-test get gatewayThe following command output is returned:
NAME AGE bookinfo-gateway 88s
Verify the microservices of Bookinfo
-
Obtain the host address of the Istio gateway.
Select an Istio Ingress Service based on the cluster type. In this topic, LoadBalancer is selected as the Istio Ingress Service.
kubectl -n istio-system get service istio-ingressgatewayThe following command output is returned:
[xxx@xxx ~]# kubectl -n istio-system get service istio-ingressgateway NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE istio-ingressgateway LoadBalancer 10.96.xxx <pending> 15021:31682/TCP,80:32247/TCP,443:31049/TCP,31400:30519/TCP,15443:31511/TCP 43mThe istio-ingressgateway parameter of the returned message indicates the host address (in the
IP:Portformat) of Istio Ingress Gateway. In this topic, the host address is10.96.XX.XX:80. -
Create a test pod to verify the microservices of Bookinfo.
-
Create a file named test-pod.yaml and copy the following template into the file:
-
Deploy the pod.
kubectl apply -f test-pod.yaml
-
-
Log on to the test pod and run the following commands to verify the microservices of Bookinfo.
kubectl exec -it centos -- bashcurl -s http://10.96.XX.XX:80/productpage | grep -o "<title>.*</title>"Replace
10.96.xxx:80with the internal address of your ingress gateway. If the command returns<title>Simple BookStore App</title>, the Bookinfo application is accessible through the Istio ingress gateway.