Updated on 2024-03-18 GMT+08:00

Grayscale Release Practices of Bookinfo

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 user experience.

Introduction

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.

Figure 1 Grayscale release process of Bookinfo

Architecture Analysis of Bookinfo

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:

  • 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.17.0) version does not call the ratings service.
  • The v2 (1.17.1) version calls the ratings service and uses one to five black stars to show ratings.
  • The v3 (1.17.2) version calls the ratings service and uses one to five red stars to show ratings.

To demonstrate traffic switching between versions, this section takes v2 (rating with black stars) and v3 (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 Envoy 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.

Preparations

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. Set the parameters as prompted and click Create Now.

  2. (Optional) Create a key pair.

    To log in to a cluster node using a key pair, 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, which will route the traffic to backend services.

    1. Log in to the Elastic Load Balance (ELB) console.
    2. Click Create Elastic Load Balancer in the upper right corner.
    3. VPC and Subnet: Select the VPC and subnet created in 1, configure other parameters as prompted, and click Apply Now.

  4. Create a cluster.

    1. Log in to the Cloud Container Engine (CCE) console.
    2. In the navigation pane, choose Resource Management > Clusters. Then, click Create CCE Cluster in the upper right corner.
    3. On the Configure page, configure 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.
    4. Click Next: Create Node, configure the following parameters, and retain the default values for 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.

      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.

Creating a Mesh

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

    • Mesh Edition

      The default value is Basic edition.

    • Mesh Name

      Enter the mesh name.

    • Istio Version

      Select the 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.

  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 mesh is enabled for the cluster, you can quickly create a Bookinfo demo.

  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 load balancer that is in the same VPC and subnet as the selected cluster, set an external port, and click Install.

    Figure 4 Installing Bookinfo

  5. Wait until Bookinfo is created. Click Service Management and ensure that the value in the Configuration Diagnosis Result column is Normal. The Bookinfo contains the productpage, details, reviews, and ratings services.

    Figure 5 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 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, 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 to v3.
    • Pods: Retain the default value.
    • Pod Configuration: Set the image tag to 1.17.2 and retain the default values for other parameters.

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

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.

  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 percentage 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 percentage of v3 to 20%.

    Figure 6 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. 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 7 v1 page
    Figure 8 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 9 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. You can find that only red stars (v3) are used in the Book Reviews area.

    Figure 10 v3 page

Ending the Grayscale Release Task

After v3 takes over all the traffic from 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 11 Ending the 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 performing the grayscale release using ASM. Delete applications and nodes in time to avoid unnecessary 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 12 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.