Sign inSign up

codefresh/k8s-canary

By codefresh

•Updated over 7 years ago

Custom Canary K8s Docker image for Codefresh pipeline usage

Image
0

617

codefresh/k8s-canary repository overview

⁠k8s-canary-deployment

Performing a kubernetes deployment with canary

This is a shell script that can perform a gradual deployment in K8s using canaries.

It uses the kube-help image because it is using kubectl

It does the following

  1. Reads the existing deployment from the cluster to a yml file
  2. Changes the name of the deployment and the docker image to a new version
  3. Deploys 1 replica for the new version (the canary)
  4. Waits for some time (it is configurable) and checks the number of restarts
  5. If everything is ok it adds more canaries and scales down the production instances
  6. The cycle continues until all replicas used by the service are canaries (the production replicas are zero)

If something goes wrong (the pods have restarts) the scripts deletes all canaries and scales back the production version to the original number of replicas

The canary percentage is configurable. The script will automatically calculate the phase

Example

  • Production instance has 5 replicas
  • User enters canary waves to 35%
  • Script calculates 35% is about 2 pods
PhaseProductionCanary
Original50
A51
B33
C15
Final05

Notes:

  • The healthcheck is a bit flaky. It only looks at number of restarts and it doesn't actually wait for the pods to be fully deployed

Tag summary

Content type

Image

Digest

Size

56.1 MB

Last updated

over 7 years ago

docker pull codefresh/k8s-canary:master