Istio is an open source service mesh that provides traffic management, observability, security, and policy capabilities. Istio that is integrated with Kubernetes can help you better manage and control container applications and improve the performance, security, and reliability of applications. This topic describes how to use Istio to deploy the Bookinfo application in a self-managed Kubernetes cluster that is connected to Elastic Container Instance by using a VNode.
Background information
Istio is an open source service mesh platform that is used to manage traffic between microservices and handle network communications and security risks. Istio can be integrated with Kubernetes to provide standard and secure traffic management and simplify deployment and O&M work.
Bookinfo imitates a single catalog entry of an online bookstore to display information about a book, including the description of the book, book details such as ISBN and number of pages, and reviews about the book. Bookinfo is a heterogeneous application and consists of four microservices that are written in different languages to demonstrate various Istio features. The end-to-end architecture of Bookinfo:
Productpage: a Python microservice that calls the Details and Reviews microservices to generate a page. The Productpage microservice provides the logon and logoff features.
Details: a Ruby microservice that contains book information.
Reviews: a Java microservice that contains book reviews. The Reviews microservice 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 generated based on book reviews.
For more information, visit Istio.
Prerequisites
The description in this topic is applicable 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.yaml
The following command output is returned:
View the status of Bookinfo.
kubectl -n istio-test get pods -o wide
The following command output is returned:
Check the micorservices of Bookinfo.
kubectl -n istio-test get services
The following command output is returned:
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.yaml
The following command output is returned:
View the Istio gateway.
kubectl -n istio-test get gateway
The following command output is returned:
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, select LoadBalancer as the Istio Ingress Service.
kubectl -n istio-system get service istio-ingressgateway
The following command output is returned:
The istio-ingressgateway parameter of the returned message indicates the host address (in the
IP:Port
format) 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 -- bash
curl -s http://10.96.XX.XX:80/productpage | grep -o "<title>.*</title>"
Replace
10.96.XX.XX:80
with the host address that you obtained in step 1. If<title>Simple BookStore App<title>
is returned, Istio runs on the VNode. Sample command output: