Skip to content

Canary Deployment with CNO Deploy

With Canary deployment, you can deploy your app in two versions directly in the production environment and transition from one to the other through percentage and easily rollback if the new version is not viable.

Prerequisites: By this stage, you should have already created your deployment and service. If you haven't, head back to Continuous Deployment

Deploying the Canary Strategy from CNOCTL

Run this command to deploy your workload with the Canary strategy:

cnoctl deploy canary <WorkloadName> -p <project name> -e <environment name>
Supported Flags:

-e or –environment: The environment name.

-p or –project: The project name.

--traffic: This refers to the % of your users that will be routed to the new version.

--image: The docker image of your application. It should be in /. When using the image flag, the version flag is required.

--version: the version of your application docker image i.e the tag. When using the version flag, the image flag is required.

--go-to-live: To completely push the new version to live.

Let's look at your workload:

cnoctl get workload -p <project name> -e <environment name>

It should look similar to this:

NAME STRATEGY REPLICAS IMAGE AUTO-DEPLOY LIVE STAGING STAGING-TRAFFIC HEADERS
workload Name canary replicas Number username/workloadName true/false V1.0.0 0

Deploying the New Version

To deploy the new version of your application to

cnoctl deploy canary my-workload  --image <image-name> --version v2.0.0 --traffic 5 -p projectName -e environmentName 

Supported Flags:

--image: The docker image of your application. It should be in /. When using the image flag, the version flag is required.

--version: the version of your application docker image i.e the tag. When using the version flag, the image flag is required.

Setting Traffic

You can set the percentage (%) of your users that will be routed to the new version. Run the command:

cnoctl deploy canary my-workload --traffic 50 --project projectName --env environmentName
Let's look at your workload:
cnoctl get workload -p project name -e environment name

Results:

NAME STRATEGY REPLICAS IMAGE AUTO-DEPLOY LIVE STAGING STAGING-TRAFFIC HEADERS
workload Name canary replicas Number username/workloadName true/false V1.0.0 50

Going Live with CNOCTL

To push your new version to completely replace your old version, simply run the command:

cnoctl deploy canary my-workload --go-to-live -p projectName -e environmentName

Deploying the Canary Strategy from CNO UI

Go to Deploy > Continuous Deploy

You’ll see all workloads. Choose the edit button on the left of your workload. You’ll see a dropdown. Choose Canary

Click update and your workload will be deployed.

You can effectively manage your canary deployment through the CNO UI Edit Form. From scaling up and down your application, choosing the right version for your staging application to manually and automatically increasing traffic to your staging application.

Deploying the New Version with CNO UI

To deploy the new version to your staging environment, simply click the dropdown next to "Staging" and choose the correct version from the image tags CNO pulled from your company's docker image.

Increasing Traffic Manually with CNO UI

To increase or decrease the percentage(%) of your total traffic your load balancer sends to your new version, simply type in the percentage and click "Update" at the bottom of the form.

Progressive Deployment

To automatically increase progression. Click the Green "Progressive Deployment" text.

Auto Progression:

When enabled you don’t have to manually increase the progression of traffic to your staging application. You can set an interval and traffic will be automatically progressed when the conditions are reached. This is only accessible through the UI.

  • Interval(secs or mins): The period of time after which requests to the new version will be evaluated against the Success Rate and Latency Values, to determine if traffic to the new version will be increased or not.

  • Type- Increment(%): Degree of increase after every successful interval.

  • Type - Steps: The degree of increase after each successful interval e.g increase by 5% after the first successful interval, then increase by 10% after the second successful interval.

  • Success Rate(%): Degree of successful connections to the new version.

  • Latency(secs): How long it takes for the new version to respond to requests.

Going Live with CNO UI

When you're completely satisfied with the new version of your application and you wish to push it live. Select your image deployment "Go To Live" and you'll be taken to the Go-to-live page of your workload. Simply click the button in front of your staging application link.

You'll be taken to a prompt page, confirm and your staging application will be pushed live while your former live application will be pushed to the staging environment.


Last update: 2022-12-06