Application Service Mesh (ASM) is a service mesh platform developed based on Istio and seamlessly interconnects with Cloud Container Engine (CCE). With better usability, reliability, and visualization, ASM provides you with out-of-the-box features and enhanced experience.
Grayscale releases enable smooth iteration of software products in production environments. This section takes Bookinfo as an example to illustrate Istio-based service governance using ASM.
The grayscale release process of Bookinfo is as follows.
Bookinfo is an application that functions as an online bookstore that displays each book with its description, details (such as pages), and reviews.
Bookinfo consists of four independent services developed in different languages. These services demonstrate the features of a typical service mesh. They are described as follows:
The reviews service has three versions:
To demonstrate traffic switching between versions, this section takes 1.17.1 (rating with black stars) and 1.17.2 (rating with red stars) of the reviews service as examples.
Running Bookinfo with ASM does not require any changes on the application itself. Simply configure and run the services in the ASM environment, that is, inject an Envoy sidecar into each service. Figure 3 shows the final deployment.
All services are integrated with Envoy sidecars. All inbound and outbound traffic of the integrated services is intercepted by sidecars. In this way, ASM can provide service routing, telemetry data collection, and policy implementation for Bookinfo.
Perform the following operations:
Virtual Private Cloud (VPC) provides a logically isolated, configurable, and manageable virtual network environment, improving resource security and simplifying network deployment.
To log in to a cluster node using a key pair, create a key pair in advance.
For security purposes, a key pair can be downloaded only once. Keep it secure to ensure successful login.
A load balancer will be used as the external access entry of a service mesh, which will route the traffic to backend services.
This is the minimum specifications for deploying Bookinfo.
System resource add-on must be installed. Advanced functional add-on is optional.
It takes about 6 to 10 minutes to create a cluster. You can click Back to Cluster List to perform other operations on the cluster or click Go to Cluster Events to view the cluster details.
The image name and tag of each service must be the same as those in Table 1. Otherwise, the experience task may fail.
Service |
Image Name |
Image Tag |
---|---|---|
productpage |
examples-bookinfo-productpage-v1 |
1.17.0 |
details |
examples-bookinfo-details-v1 |
1.17.01.17.0 |
ratings |
examples-bookinfo-ratings-v1 |
1.17.01.17.0 |
reviews |
examples-bookinfo-reviews-v1 |
1.17.1 |
examples-bookinfo-reviews-v1 |
1.17.2 |
The following uses Bookinfo images as an example:
docker pull docker.io/istio/examples-bookinfo-productpage-v1:1.17.0
docker pull docker.io/istio/examples-bookinfo-details-v1:1.17.0
docker pull docker.io/istio/examples-bookinfo-ratings-v1:1.17.0
docker pull docker.io/istio/examples-bookinfo-reviews-v2:1.17.0
docker pull docker.io/istio/examples-bookinfo-reviews-v3:1.17.0
docker tag docker.io/istio/examples-bookinfo-productpage-v1:1.17.0 swr.xxxxxxxxx./group/examples-bookinfo-productpage-v1:1.17.0
docker tag docker.io/istio/examples-bookinfo-details-v1:1.17.0 swr.xxxxxxxxx./group/examples-bookinfo-details-v1:1.17.0
docker tag docker.io/istio/examples-bookinfo-ratings-v1:1.17.0 swr.xxxxxxxxx./group/examples-bookinfo-ratings-v1:1.17.0
docker tag docker.io/istio/examples-bookinfo-reviews-v2:1.17.0 swr.xxxxxxxxx./group/examples-bookinfo-reviews-v1:1.17.1
docker tag docker.io/istio/examples-bookinfo-reviews-v3:1.17.0 swr.xxxxxxxxx./group/examples-bookinfo-reviews-v1:1.17.2
swr.xxxxxxxxx. indicates the image repository address, and group indicates the organization name. Replace them with the actual values.
docker push swr.xxxxxxxxx./group/examples-bookinfo-productpage-v1:1.17.0
docker push swr.xxxxxxxxx./group/examples-bookinfo-details-v1:1.17.0
docker push swr.xxxxxxxxx./group/examples-bookinfo-ratings-v1:1.17.0
docker push swr.xxxxxxxxx./group/examples-bookinfo-reviews-v1:1.17.1
docker push swr.xxxxxxxxx./group/examples-bookinfo-reviews-v1:1.17.2
The default value is Basic edition.
Enter the service mesh name.
Select the Istio version supported by the service mesh.
Select the cluster created in 4.
To achieve HA, select two or more nodes from different AZs.
It takes about 1 to 3 minutes to create a service mesh. If the service mesh status changes from Installing to Running, the service mesh is successfully created.
After the service mesh is enabled for the cluster, you can quickly create a Bookinfo demo.
A new grayscale version of the reviews service of Bookinfo will be created. A grayscale policy will be configured to divert traffic of the default version to the new version.
The following steps will guide you to create a new version (v3) of the reviews service and divert 30% traffic of Bookinfo to this version.
Deploying a grayscale version
Configuring a traffic policy
Configure a grayscale policy for the grayscale version. A specified percentage of traffic will be diverted from the original version to the grayscale version.
Policy Type: The value can be Based on traffic ratio or Based on request content.
In this example, configure a traffic policy Based on traffic ratio and set the traffic percentage of v3 to 20%.
It takes several seconds for the traffic policy to take effect. You need to enable APM to view the traffic monitoring data of the original version and grayscale version.
while true;do wget -q -O- http://ip:port/productpage; done
Return to the Monitor and Manage Traffic page on the console and view the real-time traffic monitoring data of v1 and v3.
Check whether the number of resources in v3 matches that in v1. After confirming that v3 is able to serve all the traffic of v1, switch all the traffic from v1 to v3.
A message indicating that the traffic is successfully switched is displayed in the upper right corner. Frequently refresh the Bookinfo page. You can find that only red stars (v3) are used in the Book Reviews area.
After v3 takes over all the traffic from v1, bring v1 offline to release its resources.
Bringing a version offline will delete all its workloads and Istio configuration resources.
This is the end of the demo of performing the grayscale release using ASM. Delete applications and nodes in time to avoid unnecessary fees.
After an experience task is uninstalled, go to the CCE console and manually delete the workloads corresponding to the grayscale version of the service for which grayscale release has been completed.