I am trying to understand how can i use canary testing with a managed instance group,

from what i learnt so far i do need to create an instance template and an instance group based on the new code changes i made, my question is : do i have to use the same Load-balancer and add the new instance group (canary instances) as a back-end and then distribute the traffic over the old instance group and the new one.

or is there any option to use the old Managed instance group to roll updates into part of the instance group and in case of success roll updates to the rest. Thank you


You can add your canary instances (with new instance template) to an existing managed instance group(MIG). The way it works is two instance templates (with different versions of your code) can be used by the same MIG but applied to a certain number or percentage of instances. For instance, if you have an instance group with 10 instances, you can do a rolling update on the group to have 10% of instances use the new instance template. And if successful, you can roll it out to the rest of the group, otherwise roll it back.

One draw back is you can't guarantee a specific percentage of traffic to go to your canary from the global load balancer perspective. At the MIG level though, both the canary and old code will receive traffic in round robin mode.

You can find the implementation details here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.