Canary Release
This method serves as an efficient way to test performance and reliability of a service. It can help detect potential problems in the actual environment while not affecting the overall system stability.
- You need to enable KubeSphere Service Mesh.
- You need to enable so that you can use the Tracing feature.
- You need to create a workspace, a project and a user (). The user must be invited to the project with the role of
operator
. For more information, see Create Workspaces, Projects, Users and Roles.
Step 1: Create a Canary Release Job
Log in to KubeSphere as
project-regular
and navigate to Grayscale Release. Under Release Modes, click Create on the right of Canary Release.Set a name for it and click Next.
On the Service Settings tab, select your app from the drop-down list and the Service for which you want to implement the canary release. If you also use the sample app Bookinfo, select reviews and click Next.
On the New Version Settings tab, add another version of it (e.g
kubesphere/examples-bookinfo-reviews-v2:1.16.2
; change tov2
) and click Next.You send traffic to these two versions (
v1
andv2
) either by a specific percentage or by the request content such as ,Cookie
andURI
. Select Specify Traffic Distribution and move the slider to the middle to change the percentage of traffic sent to these two versions respectively (for example, set 50% for either one). When you finish, click Create.
Now that you have two available app versions, access the app to verify the canary release.
Visit the Bookinfo website and refresh your browser repeatedly. You can see that the Book Reviews section switching between v1 and v2 at a rate of 50%.
You can see half of the traffic goes to each of them.
The new Deployment is created as well.
Expected output:
Step 3: View Network Topology
Execute the following command on the machine where KubeSphere runs to bring in real traffic to simulate the access to Bookinfo every 0.5 seconds.
Note
Make sure you replace the hostname and port number in the above command with your own.
In Traffic Monitoring, you can see communications, dependency, health and performance among different microservices.
KubeSphere provides the distributed tracing feature based on , which is used to monitor and troubleshoot microservices-based distributed applications.
On the Tracing tab, you can see all phases and internal calls of requests, as well as the period in each phase.
Click any item, and you can even drill down to see request details and where this request is being processed (which machine or container).
Step 5: Take Over All Traffic
If everything runs smoothly, you can bring all the traffic to the new version.
In Release Jobs, click the canary release job.
Access Bookinfo again and refresh the browser several times. You can find that it only shows the result of reviews v2 (i.e. ratings with black stars).