Skip to content

Canary Deployment Strategy

Canary with Kubernetes gocno.io

Software deployment always differs from company to company, and while it is an essential aspect of a business, it can have an adverse effect. Having the right development team can go a long way in improving the chances of a software company in every ramification.

Selecting the proper deployment method is vital to the growth of a business. As long as you develop software and application, you will undoubtedly have to deploy the software and application. No software company wants to release software and see it fail or users complain too much about it.

Now having software that can enable you to test run your software and applications before sending it out on a large scale is a keeper, and that is what the Canary Deployment Strategy does. So in this article, lets have a look at what the Canary Deployment Strategy is all about.

What Is Canary Deployment?

A Canary is a popular yellow bird, why is a bird used as the icon for a deployment strategy? Time for a little story, decades ago miners carried down a caged canary into the mining tunnels. If there was a high level of dangerous gases such as carbon monoxide and other toxic gases collected in the mine, the gas would kill the canary before killing them, thus warning them to exit the tunnel immediately. Like the canary birds alerted miners of toxic gases, they play the same role in the software world.

Now in the software world, canary deployment is a powerful tool when it comes to CI/CD. Canary deployment offers you another layer of testing that you can use to test software and applications against real-time users without risking deploying a potentially faulty version to your entire user base.

You can run these tests in a staging environment and use them to provide a very robust deployment solution that can give you confidence in your development process as they go out. But something to note is that the above method can never perfectly replicate real-world users of the application, no matter how hard you try to simulate it.

So you have to do a lot of work to ensure the tests are as valid as possible; that they are similar to real-world situations as closely as possible. Canary deployment allows you to test using real value to overcome problems and technical glitches to a certain degree. The canary deployment also means that you push new codes to a small group of users; usually, those users are completely unaware that they are using the new code.

Canary allows you to see how your code performs in the real world; while limiting the impact of any bugs. With canary deployment, a new version of an application is deployed to a selected percentage of users while the old one still exists. It can then be deployed for everyone to use when it is tested and improved.

Canary deployment enables developers and brands to gradually introduce something new into the market and survey its performance, acceptance and improvements that need to be done on the application.

Some benefits of canary deployment include;

  • It alerts developers of unforeseen bugs, glitches and problems.

  • It serves as a testing pad.

  • Developers get early feedback and can make amendments and improvements on time.

  • It enables scalability.

  • It uses a realistic environment and shows the same outlook as the application.

  • It brings flexibility to businesses.

  • Monitoring of code performance.

Canary Use Cases

Canary Use Cases

Canary deployment is very flexible and brings a lot of possibilities to software development. As a software company, having a team of developers who are skilled and have the needed expertise when it comes to software deployment is a significant plus for the company.

To be the best, you must use the right tools to produce something of great value and quality that users will embrace. Hence how can Canary deployment be deployed?

  • Step 1- Canary Group: You have to identify your canary percentage, what percentage will produce meaningful results. The canary group will be a random subset of users but you can choose what percentage of your users will be tested against: 5%, 10% or even higher.

  • Step 2 - Testing Environment: The testing environment uses hardware and software by the development team to carry out a test. So here, you use the load balancer to route requests from the canary testers to the new environment.

  • Step 3 - Canary Test: Here as a developer, you monitor the canary test after initiating. You do this to ensure that the new application functions well with its features.

  • Step 4 - Result: In this step, if the new application is functioning well, you are good to go; if it is not, you reroute users back to the original application.

  • Step 5 - Fixing: Go ahead and fix the bugs and glitches present in the application to make improvements.

Which Tools For Progressive Deployment Are Used In The Usual Canary Strategy?

Canary Deployment Progressive deployment is a software practice that enables you to push out new features to users to get feedback and improve. Here you can monitor the software in a controlled fashion. So here are tools for progressive deployment that are used in the Canary strategy in the above image;

  1. Docker

  2. Git

  3. Weave flux and Flagger

  4. Prometheus

  5. Istio

This is a common Canary deployment strategy process.

Git: Our favourite distributed version control: tracks changes to your application git repository. When you commit a change,

Weave Flux and Flagger pulls it, fetches the image versions needed from Docker and deploys Version 1 and 2 Simultaneously.

Prometheus monitors both versions and alerts you when anything goes awry. And,

Istio provides the control you’ll need for the canary deployment, i.e what percentage of your userbase uses Version 2.

As you can see, this involves many tools which require seperate mastering of, which can be a notable barrier to adopting Kubernetes on a large scale.

Canary Deployment with CNO

Canary CNO

As is obvious in the above image, CNO centralises all processes of canary deployment. Thereby greatly simplifying the process while still allowing adoption of Kubernetes on a large scale.

  • CNO IAM ensures only authorised personel can make changes to your application.

  • CNO ONBOARD takes the place of Flux and Flagger and manages your projects, environments, namespaces and resources required all from a single control point.

  • CNO HUB handles your multi-cloud infrastructure and centralises all your Kubernetes clusters.

  • CNO DEPLOY monitors and serves as the control for the two versions.

Every feature working in unison to create a seamless and easily scalable multicloud application.

Relevant Metrics (Example)

1) Business Metrics:

The essence of conducting a canary deployment is so you can know whether to push or roll back your application, technically to get a yes or no for your product. Knowing the right metrics to use gives you a gauge of your performance and a better understanding of the features to add.

You need to select and evaluate your metrics to know the right ones to choose. To choose the relevant metrics, you must select the metrics that align with the purpose of the application. For example, if you are building an online shopping application, metrics like the speed, number of transactions per second and minutes, etc. need to be noted.

2) Fast And Slow Metrics:

Also, you might choose to monitor the application's CPU utilisation, internal error counts, latency, etc. There are fast and slow metrics depending on the generation process. So, ensure a balanced set of metrics so you can understand the canary's health well. For example, latency checks and a server query can be a set of slow and fast metrics.

3) Metrics Standard Ranging:

The metrics need to have a range and standard. Balancing the metrics allows you to identify the bad canaries from the good ones. For example, deploying a canary only to find out that it has some hidden issues could lead to more complications.

4) Metrics Correlation:

Grouping and finding the correlation of the metrics might be tasking, but it is imperative. For example, if a batch query causes an increase in the CPU system in terms of usage, it can lead to a poor metric because the dramatic increase in the CPU can affect other processes.

Conclusion

Canary deployment helps businesses stay afloat. The testing ground is available to test their software, application, etc. Development teams have more opportunities to create fantastic applications and software. Life is generally good with the Canary deployment strategy, and life will be better with CNO to help ease the process.

To bring a new product into the tech market or add new features to an application, the thought of how it will affect the users and their reception of that change comes to mind. Why not test run it by the users and weigh their response; You have the opportunity to make this possible with the Canary deployment strategy.


Last update: 2022-11-20