1 BookInfo architecture introduction

Bookinfo is an example of Istio. You can learn more about routing, telemetry and other functions provided by Istio through bookinfo.

Here is the physical architecture of BookInfo before Istio was embedded:

Bookinfo is an online bookstore application that consists of four microservices: Product Page, Reviews, Details, and Ratings. To demonstrate the non-invasive nature of Istio, these four microservices were developed in Python, Java, Ruby, and Node. The following are explained as follows:

Book Details

Ratings: Book booking ranking service

Reviews: Book Review service It is also an aggregation service that aggregates Ratings

Product Page: An aggregation service where content is aggregated from Reviews and Details content

Here is the physical architecture of Bookinfo with Istio embedded:

The architecture diagram demonstrates that each bookInfo microservice embedded in Istio will have an additional Envoy, called a Sidecar, that will take over all network traffic in and out of the microservice it is paired with. Actually Envoy (sidecars) role as your mobile phone, it is gradually put you into a deaf mute, and vegetable, it carries on the entry and exit all of your information, some people and organizations that have ulterior motives to monitor through the mobile phone, telemetry, and routing control, control of your mind, public opinion direction, aesthetic interest and other purposes.


2 BookInfo configuration and deployment

2.1 Configuring automatic Istio Injection

Because BookInfo starts multiple pods, manual injection of sidecar each time is tedious, so we use batch injection. If you are not familiar with Sidecar injection, please refer to my previous blog post.

# kubectl create ns jiuxi Create jiuxi namespace
# kubectl label ns jiuxi istio-injection=enabled
# kubectl get ns jiuxi --show-labels
Copy the code

The following screenshot is taken after the command is successfully executed:

2.2 Deploying the BookInfo application

The BookInfo application is deployed in the jiuxi namespace:

# kubectl apply -f bookinfo/platform/kube/bookinfo.yaml -n jiuxi
Copy the code

The deployment process is as follows:

Run the following command to view bookinfo’s list of services:

kubectl get svc -n jiuxi

The screenshot of the service list is as follows:

Run the following command to view bookinfo’s pod list:

# kubectl get pod -n jiuxi
Copy the code

2.3 Verifying bookInfo deployment

Find the ProductPage service in the list of services and use the curl command to verify that the service has been published successfully.

# kubectl get svc -n jiuxi
# curl http://SVC_CLUSTER_IP:9080 | grep -o "<title>.*</title>"
Copy the code

The following information is displayed:

Since then, the entire BookInfo application has been successfully deployed.


3 Set the Bookinfo gateway

The above steps already give you access to the BookInfo application. But I know some of you are still embarrassed, because many of you still see the world through a browser.

The gateway is equivalent to the door of your house. Whenever you come home hungry, you can control the aroma of the food in the next door by fully open, half-open or slit. Subsequent courses will be devoted to the deeper principles and applications of gateways. Here you first have a superficial understanding of it.

3.1 Define the BookInfo entry gateway

#Kubectl apply - f istio - 1.4.5 / samples/bookinfo/networking/bookinfo - gateway. Yaml -n jiuxi
Copy the code

3.2 Verifying that a gateway has been created

# kubectl get gateways.networking.istio.io -n jiuxi
Copy the code


4 Access the BookInfo application

4.1 get INGRESS_HOST

# kubectl get po -l istio=ingressgateway -n istio-system -o jsonpath='{.items[0].status.hostIP}'
Copy the code

4.2 get INGRESS_PORT

# kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}'
Copy the code

4.3 Accessing the BookInfo Application through a Browser

The host and port information is obtained according to 4.1 and 4.2, as shown in the following screenshot:

Based on this host and port, open a browser to access:

Refresh the page a few times and you’ll find multiple Reviews versions used by the BookInfo app, as follows:

This corresponds to the POD message:


5 Uninstall the BookInfo application

You’ve created BookInfo and have the thrill of creating it. Maybe you’re feeling a little lost because you think your tech life isn’t perfect and you want to blast everything you’ve built, so what are you waiting for? Execute the following statement:

#. / istio 1.4.5 / samples/bookinfo/platform/kube/cleanup. Sh
Copy the code

After the command is successfully executed, the following screenshot is displayed:

5.1 Verifying uninstallation

Verify that you uninstalled successfully by executing the following command:

# kubectl get virtualservices.networking.istio.io -n jiuxi
# kubectl get destinationrules.networking.istio.io -n jiuxi
# kubectl get gateways.networking.istio.io -n jiuxi
# kubectl get pod -n jiuxi
Copy the code

But if the destruction feels good to you, like chewing dazzle and you can’t stop, you can do the following:

# rm -rf /     If you dare to do that, I will worship you
Copy the code

6 summarizes

This section completes the basics of Istio with the Bookinfo application. I believe that in the process of operation, you still have a lot of do not understand the place, but it does not matter, the subsequent author will be your paoding solution. All you need to do is follow me through, familiarize yourself with the process, and at some point you’ll scream “I got it.”