Skip to content

Latest commit

 

History

History

canary

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Canary

A canary deployment consists of routing a subset of users to a new functionality. In Kubernetes, a canary deployment can be done using two Deployments with common pod labels. One replica of the new version is released alongside the old version. Then after some time and if no error is detected, scale up the number of replicas of the new version and delete the old deployment.

canary

Go to the right directory

cd ~/Workshop-K8S/k8s/canary/

Create namespace

kubectl create namespace canary

Deploy v1

kubectl -n canary apply -f hello-world-v1.yaml

Test

Test:

curl http://[public ip adress load balancer]/api

Or in browser: http://[public ip adress load balancer]

Deploy v2 besides v1

kubectl -n canary apply -f hello-world-v2.yaml

Check that requests are handled by v1 and v2

while sleep 0.5; do curl [public ip adress load balancer]/api; done

Stop with CONTROL-C

Scale v2 to 3

kubectl -n canary scale --replicas=3 deployment/hello-world-v2
kubectl -n canary get pods -w

Test:

curl http://[public ip adress load balancer]/api

Or in browser: http://[public ip adress load balancer]

Delete v1

kubectl -n canary delete deployment/hello-world-v1
kubectl -n canary get pods

Test:

curl http://[public ip adress load balancer]/api

Or in browser: http://[public ip adress load balancer]

Clean up

kubectl delete ns canary