When you deploy a new version of a microservice, pushing changes to all instances at once risks widespread failures if defects surface. A canary release mitigates this risk by deploying the new version to a small subset of instances first. After you verify that the canary instances are healthy, you promote the release to the remaining instances in controlled batches. If issues arise, you roll back before the change reaches your full fleet.
The following sections describe how to configure and run a canary release for Spring Cloud or Dubbo microservices in a Kubernetes cluster through the EDAS console.
How a canary release works
A canary release in EDAS follows this sequence:
EDAS creates a canary instance group and deploys the new version to a specified number of instances.
Traffic routes to the canary group based on your chosen rule -- content-based matching, percentage-based splitting, or lane-based routing.
You verify the canary group by checking whether traffic is distributed as expected.
After verification, you promote the release by deploying the new version to the remaining instances in one or more batches.
If issues arise at any point, you roll back to the previous version.
The following table summarizes the three traffic routing strategies so you can choose the one that fits your use case:
| Strategy | Best for | How it works |
|---|---|---|
| Canary Release by Content | Testing with specific users, requests, or parameters | Routes traffic based on request attributes (headers, cookies, or parameters) that match your conditions |
| Canary Release by Ratio | Gradual percentage-based rollout | Sends a fixed percentage of all traffic to the canary group |
| Canary Release By Lane | End-to-end traffic isolation across a microservices call chain | Routes traffic through a predefined lane to isolate the call chain |
Limitations
High-Speed Service Framework (HSF) applications: Canary release is not supported.
Dubbo applications: Fully supported without restrictions.
Spring Cloud applications: Do not use canary release if your application relies on
Deployment.Metadata.NameorDeployment.Metadata.Uidto configure features. Otherwise, the native features of the application may be abnormal after the canary release.Ingress applications: If a Server Load Balancer (SLB) instance forwards traffic directly to your ingress application, the SLB routing policy does not follow the canary release rules.
NoteTo use canary release with an ingress application, create a client application and a server application with multiple replicas. Implement canary release on the server application, and associate the SLB instance with the client application.
Prerequisites
Before you begin, make sure that you have:
A Spring Cloud or Dubbo application deployed in a Kubernetes cluster on EDAS
The deployment package (JAR or WAR) or container image for the new version
(For Container Registry) The aliyun-acr-credential-helper component installed in your cluster. See Use the aliyun-acr-credential-helper component to pull images without using a secret
(For Container Registry Enterprise Edition) Virtual Private Cloud (VPC) access configured. See Configure a VPC ACL
Start a canary release
Log on to the EDAS console.
In the left-side navigation pane, choose Application Management > Applications.
In the top navigation bar, select a region. In the upper part of the page, select a microservices namespace from the Microservices Namespace drop-down list.
From the Cluster Type drop-down list, select Kubernetes Cluster, then click the name of the target application.
In the upper-right corner of the Application Overview page, choose Deploy > Deploy.
On the Set Deployment Mode page, find the Canary Release (Phased) section and click Start Deployment.
On the Canary Release (Phased) page, configure the following three areas, then click OK:
Deployment method
Release policy
Canary release rule
Verify and promote the release
After the canary batch deploys, the deployment progress and status appear on the Upgrade History page. Verify the new version before promoting it to the remaining instances.
Check whether the traffic is distributed as expected. For more information, see Monitor canary traffic.
After verification, go to the Change List page and click Start the Next Batch to deploy the next batch.
Repeat until all batches complete.
Roll back a release
If you find issues during verification, roll back the canary release:
On the Change List page, click RollBack in the upper-right corner.
In the confirmation dialog box, click OK.
Verify completion
After all batches finish, go to the Application Overview page and check the Deployment specifications section. Confirm that the deployment package version matches the new version.