All Products
Search
Document Center

Enterprise Distributed Application Service:Use the EDAS console to implement canary releases of applications in Kubernetes clusters

更新時間:Feb 29, 2024

For Spring Cloud or Dubbo microservices applications that are deployed in a Kubernetes cluster, you can implement a canary release. The canary release allows you to verify a new application version on a small number of instances. If the verification is successful, you can update the application on all of your instances to the new version. This makes the update secure. This topic describes how to use the EDAS console to implement canary releases of applications in Kubernetes clusters.

Limits

  • High-Speed Service Framework (HSF) applications: Canary release is not supported.

  • Dubbo applications: You can implement canary releases of Dubbo applications without limits.

  • Spring Cloud applications: If you use Deployment.Metadata.Name or Deployment.Metadata.Uid to configure some features of an application, do not implement a canary release for the application. Otherwise, the native features of the application may be abnormal after the canary release.

  • Ingress applications: If your application is an ingress application and you use a Server Load Balancer (SLB) instance to directly forward traffic to the ingress application, the SLB traffic forwarding policy does not follow the canary release policy.

    Note

    If you still want to use the canary release feature for an ingress application, you can create a client application and a server application that has multiple replicas. Then, you can implement canary release for the server application and associate an SLB instance with the client application to allow service access by using SLB.

Procedure

  1. Log on to the EDAS console.

  2. In the left-side navigation pane, choose Application Management > Applications. In the top navigation bar, select a region. In the upper part of the Applications page, select a microservices namespace from the Microservices Namespace drop-down list.

  3. On the Applications page, select Kubernetes Cluster from the Cluster Type drop-down list. Then, click the name of the application for which you want to implement a canary release.

  4. In the upper-right corner of the Application Overview page, choose Deploy > Deploy. On the Set Deployment Mode page, click Start Deployment in the upper-right corner of the Canary Release (Phased) section.

  5. On the Canary Release (Phased) page, configure the deployment method, release policy, and canary release rule for the new version of the application based on your business requirements. Then, click OK.

    1. Configure the deployment method.

      Parameter

      Description

      Scenario

      Application Runtime Environment

      The value must be the same as that used for the previous deployment. Valid values:

      • JAR package: The application runtime environment is Standard Java Application Runtime Environment. You cannot change the type of the application runtime environment.

      • WAR package: The application runtime environment is Apache Tomcat. You cannot change the type of the application runtime environment. However, you can change the version of Apache Tomcat based on your business requirements.

      Suitable for applications that are deployed by using JAR packages or WAR packages

      Java Environment

      Select a JDK version from the drop-down list based on your business requirements.

      Suitable for applications that are deployed by using JAR packages or WAR packages

      File Uploading Method

      The type of the deployment package must be the same as that used for the previous deployment. You can use a WAR package or JAR package.

      You can upload a JAR or WAR package. You can also specify a JAR or WAR package address.

      • Upload JAR Package or Upload WAR Package: Select the downloaded JAR or WAR package.

      • JAR Package Address or WAR Package Address: Enter the address of the demo package.

      Suitable for applications that are deployed by using JAR packages or WAR packages

      Container Registry Repository Type

      Note
      • The Container Registry Repository Type parameter is available only if you deploy Java, Tomcat, or EDAS-Container (HSF) applications in ACK clusters. This parameter is unavailable if you deploy applications in ACK Serverless clusters.

      • You must install the aliyun-acr-credential-helper component. For more information, see Use the aliyun-acr-credential-helper component to pull images without using a secret.

      • If you want to use an image repository of Container Registry Enterprise Edition, configure access over virtual private clouds (VPCs). For more information, see Configure a VPC ACL.

      • The image build task for the application runs in your cluster and consumes your resources. The default resource limit for a single image build task is 1 GB per core. For more information about how to adjust resource limits for image build tasks, see How do I adjust resource limits for image building?

      If you use a repository of Container Registry Personal Edition or Container Registry Enterprise Edition to store the created image, the image build task runs in your cluster. Build tasks are subject to the following scheduling affinity and toleration rules:

      • EDAS rejects to schedule build tasks to nodes that have the edas.image.build=disable label.

      • EDAS preferentially schedules build tasks to nodes that have the edas.image.build=enable label. However, EDAS may also schedule build tasks to nodes that do not have the edas.image.build label.

      • Build tasks can tolerate nodes that have the key=edas.image.build, effect=NoSchedule taint.

      Note
      • If you do not want to schedule build tasks to specific nodes, add the edas.image.build=disable label to the nodes.

      • If you want to use a node as a dedicated node of a build task, you can add the edas.image.build=enable label and the key=edas.image.build, effect=NoSchedule taint to the node. This prevents pods that do not tolerate the taint from being scheduled to the node.

      Suitable for only applications that are deployed by using images

      Region of Container Registry

      Select the region in which your Container Registry image resides. This parameter is required only if you set the Container Registry Repository Type parameter to Container Registry Enterprise Edition.

      Container Registry

      Select your container image. This parameter is required only if you set the Container Registry Repository Type parameter to Container Registry Enterprise Edition.

      Image Repository Namespace

      Select the microservices namespace in which your image repository resides from the drop-down list. You can also click + Create Namespace to create a microservices namespace.

      Version

      The version number of the deployment package. You can use a timestamp as the version number.

      Suitable for applications that are deployed by using JAR packages or WAR packages

      Time Zone

      Select a time zone from the drop-down list based on your business requirements.

      Suitable for applications that are deployed by using JAR packages or WAR packages

      Single-pod Resource Quota

      The CPU, memory, and ephemeral storage that you want to reserve for a pod. If you want to specify a limit, enter a numeric value. The default value 0 specifies that no limit is imposed. If you do not want to configure ephemeral storage quotas for a pod, the cluster performance determines the maximum quota.

      Suitable for all applications

    2. In the Release Policy section, configure the release policy.

      Parameter

      Description

      Number of Instances for Canary Release

      The number of application instances for the release of the first batch. You can view the total number of instances on the right side of this parameter. We recommend that you set this parameter to a value less than half of the total number of instances to ensure application stability.

      Note

      After the canary release is implemented, you must manually release the remaining batches.

      Remaining Batches

      The number of remaining batches to release the application. After the release of the first batch is complete, the application is deployed to the remaining application instances based on the specified batches.

      Batch Mode

      Note

      If you set the Remaining Batches parameter to a value greater than 1, you must configure this parameter.

      The following processing methods are supported:

      • Automatic: automatically releases applications in batches based on the interval specified by the Interval parameter. Interval: the interval for releasing the remaining batches in minutes.

      • Manual: manually triggers the release of the next batch.

      Deployment Interval Between Batches

      If the number of application instances in each batch is greater than 1, the application is deployed to the application instances at the specified interval. Unit: seconds.

      The Publish Policy Configuration section on the right side shows the process for the canary release based on your configurations.

    3. Configure the canary release rule.

      EDAS supports the following canary release rules: Canary Release by Content and Canary Release by Ratio.

      Rule

      Parameter

      Description

      Canary Release by Content

      1. Click Add Policy. In the Add a canary release by content policy panel, configure the Policy Name parameter and click Create Inbound Traffic Rule and click OK.

      2. Select the created content policy from the Select Policy drop-down list.

      Note

      You can click Create Inbound Traffic Rule to create multiple inbound traffic rules. The rules can take effect at the same time.

      Policy Name

      The name of the custom canary release policy.

      Protocol Type

      • Spring Cloud

        path: a relative HTTP path.

      • Dubbo

        • Select Service: Select a service from the drop-down list.

        • Method: Select a method from the drop-down list.

      Conditional Mode

      Select Meet All Following Conditions or Meet Any of Following Conditions.

      Conditions

      • Spring Cloud: Configure parameters based on Cookie, Header, or Parameter.

      • Dubbo: Set Parameter and Expression for Getting Parameter Values to the actual values of your application.

      Canary Release by Ratio

      Traffic Ratio

      Traffic is forwarded to the current canary group based on the configured proportion.

      Canary Release By Lane

      1. Click +Add Policy. In the Add Lane Canary Release Policy panel, configure Policy Name, Lane Group, and Lane, and then click OK.

      2. In the Select Policy drop-down list, select the created lane canary release policy.

      Policy Name

      The name of the custom lane canary release policy.

      Lane Group

      Select an existing lane group. For information about how to create a lane group, see Create a lane group.

      Lane

      Select an existing lane. For information about how to create a lane, see Create a lane.

    After a canary release is started, EDAS deploys the new version of the application to the specified canary instance group. The deployment progress and status are displayed on the Upgrade History page.

    Note

    You can check whether the traffic is distributed as expected. For more information, see Monitor canary traffic.

  6. After the traffic for the canary release is verified, click Start the Next Batch on the right side of the Change List page. Complete the release of the subsequent batches.

    If an issue occurs during the verification, you can click RollBack in the upper-right corner of the Change List page. In the dialog box that appears, click OK.

    After the canary release is complete, check whether the deployment package is of the new version in the Deployment specifications section of the Application Overview page.