How to implement Canary deployment in kubernetes with different versions specified in deployment How to implement Canary deployment in kubernetes with different versions specified in deployment kubernetes kubernetes

How to implement Canary deployment in kubernetes with different versions specified in deployment


  1. You can't have multiple deployments with the same name. Rename them to process-v1 and process-v2.
  2. You need to have different selectors for each of them. First one should have matchLabels: {app: process, version: v1}, the second one matchLabels: {app: process, version: v2}.

So technically that will be two completely separate deployments. What makes them "baseline" and "canary" is how you send traffic to them. If you specify common selector (just {app: process}) in your service, then both of the deployments will see a fraction of traffic.


The name of what you want to implement is Canary Deployment. It is a great feature for A / B testing and assists in continuous delivery and production testing, it does not have to be in the same deploy the secret this in the load balancer and at the gateway. There are options in the market for this (Spring Zuul or Istio Envoy) that can provide a solution that filters content from one deploy to a certain percentage and the other to the rest ...