Help Center> Application Service Mesh> Getting Started> Grayscale Release Practices of Bookinfo
Updated on 2023-07-04 GMT+08:00

Grayscale Release Practices of Bookinfo

Application Service Mesh (ASM) is a service mesh platform developed based on Istio. It seamlessly interconnects with Cloud Container Engine (CCE), an enterprise-level Kubernetes cluster service. With better usability, reliability, and visualization, ASM provides you with out-of-the-box features and enhanced user experience.


Grayscale release facilitates smooth rollout of iterative 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.

Figure 1 Grayscale release process of Bookinfo

Architecture Analysis of Bookinfo

Bookinfo is an application that functions as an online bookstore. It displays a book with its description, details (such as pages), and reviews.

Bookinfo consists of four independent services developed in different languages. These services do not depend on ASM, but demonstrate the features of a typical service mesh, and the reviews service has multiple versions. The four services are described as follows:

  • productpage: calls the details and reviews services to generate a page.
  • details: contains book information.
  • reviews: contains book reviews and calls the ratings service.
  • ratings: contains book rating information based on reviews.

The reviews service has three versions:

  • The v1 (1.5.0) version does not call the ratings service.
  • The v2 (1.5.1) version calls the ratings service, and uses one to five black stars to show ratings.
  • The v3 (1.5.2) version calls the ratings service, and uses one to five red stars to show ratings.

To demonstrate traffic switching between grayscale versions, this section takes v1.5.1 (rating with black stars) and v1.5.2 (rating with red stars) of the reviews service as examples.

Figure 2 End-to-end architecture of Bookinfo

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.

Figure 3 Bookinfo with sidecars injected

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.

  1. Create a VPC and subnet.

    Virtual Private Cloud (VPC) provides a logically isolated, configurable, and manageable virtual network environment, improving resource security and simplifying network deployment.

    1. Log in to the VPC console.
    2. Click Create VPC in the upper right corner.
    3. Retain default settings for parameters unless otherwise specified. Then, click Create Now.

      For details, see Creating a VPC.

  2. (Optional) Create a key pair.

    To create a cluster node using the key pair login mode, create a key pair in advance.

    1. Log in to the Elastic Cloud Server (ECS) console.
    2. In the navigation pane, choose Key Pair. On the Key Pair page, click Create Key Pair in the upper right corner.
    3. Enter a key pair name and click OK.
    4. Manually or automatically download the private key file. The file name is the specified key pair name with a suffix of .pem. Securely store the private key file. In the dialog box displayed, click OK.

      For security purposes, a key pair can be downloaded only once. Keep it secure to ensure successful login.

  3. Create a load balancer.

    A load balancer will be used as the external access entry of a service mesh. Traffic managed by a service mesh will be distributed by this load balancer to backend services.

    1. Log in to the Elastic Load Balance (ELB) console.
    2. Click Buy Elastic Load Balancer in the upper right corner.
    3. Purchase a dedicated load balancer by referring to Creating a Dedicated Load Balancer.
      • Network Type: Select Public network.
      • VPC and Subnet: Select the VPC and subnet created in 1 respectively.
      Figure 4 Buying an elastic load balancer

  4. Create a cluster.

    1. Log in to the Cloud Container Engine (CCE) console.
    2. In the navigation pane, choose Resource Management > Clusters. On the displayed page, click Buy next to CCE Cluster.

      For details about how to create a cluster, see Buying a CCE Cluster.

    3. On the Configure page, set the following parameters and retain the default values for other parameters:
      • Cluster Name: Enter a cluster name, for example, cce-asm.
      • VPC and Subnet: Select the VPC and subnet created in 1 respectively.
    4. Click Next: Create Node and set the parameters as prompted. Set Specifications and Login Mode as follows, and retain the default settings for the other parameters.
      • Specifications: 4 vCPUs and 8 GB memory.

        This is the minimum specifications for deploying Bookinfo.

      • Login Mode: Select the key pair created in 2 for identity authentication upon remote node login.
    5. Click Next: Install Add-on, and select the add-ons to be installed in the Install Add-on step.

      System resource add-on must be installed. Advanced functional add-on is optional.

    6. Click Next: Confirm. Read the product constraints and select I am aware of the above limitations. Review the configured parameters and specifications.
    7. Submit the order.

      If the cluster will be billed on a yearly/monthly basis, click Pay Now and follow on-screen prompts to pay the order.

      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.

  5. Prepare the images required by Bookinfo (as shown in Table 1), push them to SWR and set their Type to Public.

    The image name and tag of each service must be the same as those in Table 1. Otherwise, the experience task may fail.

    Table 1 Image list


    Image Name

    Image Tag















    The following uses the Bookinfo image as an example:

    1. Prepare a computer that can access the Internet and has Docker 1.11.2 or later installed.
    2. Run the following commands in sequence to download the images required by Bookinfo:

      docker pull

      docker pull

      docker pull

      docker pull

      docker pull

    3. Connect to SWR. For details, see Uploading an Image Through a Container Engine Client.
    4. Label the image pulled in 5.b. Ensure that the image name and tag are the same as those in Table 1.

      docker tag

      docker tag

      docker tag

      docker tag

      docker tag

      In the preceding commands, indicates the image repository address, and group indicates the organization name. Replace them with the actual values.

    5. Push the images to the SWR.

      docker push

      docker push

      docker push

      docker push

      docker push

    6. Change the image type to Public. For details, see Setting Image Attributes.

Buying a Mesh

  1. Log in to the ASM console.
  2. Click Buy Mesh in the upper right corner.
  3. Configure the following parameters and retain the default value for other parameters.

    • Mesh Edition

      Select Basic.

    • Mesh Name

      Enter the mesh name.

    • Istio Version

      Istio version supported by the mesh.

    • Cluster

      Select the cluster created in 4.

    • Mesh Control Plane Node

      To achieve HA, select two or more nodes from different AZs.

    • Sidecar Configuration

      Select the namespace named default and enable Restart Existing Services.

      Figure 5 Sidecar configuration

  4. Review the mesh configuration in the Configuration List on the right of the page and click Submit.

    It takes about 1 to 3 minutes to create a mesh. If the mesh status changes from Installing to Running, the mesh is successfully created.

Deploying Bookinfo in One Click

After the service mesh is enabled for a cluster, you can create a Bookinfo demo in just a few clicks. The procedure is as follows:

  1. Log in to the ASM console.
  2. Click the target mesh to view its details.
  3. In the navigation pane, choose Experience Tasks and click Try Now in the Bookinfo task.
  4. On the right of the page, set Cluster to the cluster where Bookinfo resides, set Load Balancer to a shared load balancer that is in the same VPC and subnet as the selected cluster, set an external port, enter the image repository address where the Bookinfo image is stored (for example,, where group indicates the organization name), and click Install.

    Figure 6 Installing Bookinfo

  5. Wait until Bookinfo is created. After the creation is complete, click Service Management. The value of the Configuration Diagnosis Result column is Normal. The Bookinfo contains the productpage, details, reviews, and ratings services.

    Figure 7 Service list

Creating a Grayscale Release Task

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 grayscale 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

  1. In the navigation pane on the left, choose Grayscale Release. On the Canary Release area of the displayed page, click Create Release Task.
  2. Configure basic information.

    • Task Name: Enter a task name, for example, reviews-v3.
    • Namespace: Select the namespace to which the service belongs.
    • Service: Select reviews from the drop-down list box.
    • Workload: Select the workload to which the service belongs.

  3. Configure grayscale version information.

    • Cluster: Select the cluster to which the service belongs.
    • Version: Set this parameter as v3.
    • Pods: Retain the default value.
    • Pod Configuration: Set the image tag as 1.5.2 and retain the default value for other parameters.

  4. Click Release. If the progress reaches 100%, the grayscale version is successfully released.

    Figure 8 Viewing the progress

Configuring a grayscale policy

Configure a grayscale policy for the grayscale version. A specified ratio of traffic will be diverted from the original version to the grayscale version.

  1. After the grayscale version is deployed, click Configure Traffic Policy.
  2. Configure a traffic policy.

    Policy Type: The value can be Based on traffic ratio or Based on request content.

    • Based on traffic ratio: A specified ratio of traffic will be directed to the grayscale version. For example, 80% of the traffic is directed to the original version, and 20% is directed to the grayscale version.
    • Based on request content: Only the traffic that meets specific conditions will be directed to the grayscale version. For example, only users on the Windows operating system can access the grayscale version.

    In this example, configure a traffic policy based on traffic ratio and set the traffic ratio of v3 to 20%.

    Figure 9 Traffic policy

  3. Click Deliver Policy.
  4. On the Service List page, click the Access Address of the productpage service. Frequently refresh the book information page, and you can find that the Book Reviews area is switching between black stars (v1) and red stars (v3) and the ratio is nearly 4 to 1.

    Figure 10 v1 page
    Figure 11 v3 page

Switching All Traffic to the Grayscale Version

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.

  1. On the Monitor and Manage Traffic page, click Take Over All Traffic next to v3.

    Figure 12 Taking over all traffic

  2. Click OK.

    A message indicating that the traffic is successfully switched is displayed in the upper right corner. Frequently refresh the Bookinfo page, and you can find that only red stars (v3) are used in the Book Reviews area.

    Figure 13 v3 page

Ending a Grayscale Release Task

After v3 takes over all the traffic of v1, bring v1 offline to release its resources.

  1. On the Monitor and Manage Traffic page, click End Task.
  2. Click OK to end the task, bring the original version offline, and delete the task.

    Figure 14 Ending a grayscale release task

    Bringing a version offline will delete all its workloads and Istio configuration resources.

Clearing Resources

This is the end of the demo of how to perform grayscale release using ASM. Delete the application and nodes in time to avoid unnecessary fees because node and application running incurs fees.

  1. In the navigation pane, choose Experience Tasks and click Uninstall in the Bookinfo task.
  2. Click OK. After the Bookinfo experience task is uninstalled, the productpage, details, reviews, and ratings services and related resources are automatically deleted.

    Figure 15 Uninstalling experience tasks

    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.