Cheat notes · Module 03 · Releases judged by metrics
Blue-green in dev
A five-minute review for when you have done this module and want it back in your head. Open the full module for the steps and the lab, or the full text to print.
The idea
Blue-green brings the new version up as a full copy behind a preview Service and host, while every user stays on the old one. A person tries the preview and promotes, and the active Service switches to the new pods in one step. The old pods wait for scaleDownDelaySeconds so the switch can be undone fast.
Remember
- Two Services:
checkout(active) andcheckout-preview. The controller sets their selectors to a pod-template hash. - Two hosts:
checkout-dev.localtest.me(users) andpreview-checkout-dev.localtest.me(the next version). autoPromotionEnabled: false: waits for a person. Analysis replaces the person in module 04.scaleDownDelaySeconds: 30: the old pods keep running after the switch, for a fast way back.- Cost: two full sets of pods while a release waits.
Pitfalls
- A typo in the image tag leaves the preview in
ImagePullBackOff; users are fine, but the release never becomes promotable. Fix the tag in Git. - Writing the Services' selectors by hand. The controller owns them; Argo CD must not fight it.
Commands
curl -sk https://checkout-dev.localtest.me:8443/ | jq -r .version | What users get |
curl -sk https://preview-checkout-dev.localtest.me:8443/ | jq -r .version | What is waiting |
kubectl argo rollouts promote checkout -n checkout-dev | Switch everyone to the preview |
checkout-config helm/dev.yaml (module 03)
strategy: blueGreen
blueGreen:
autoPromotionEnabled: false # a person promotes
scaleDownDelaySeconds: 30
ingress:
host: checkout-dev.localtest.me
previewHost: preview-checkout-dev.localtest.me
Test yourself
Answer in your head first, then open the answer.
What decides which pods the active Service selects?
The Rollout controller, through the pod-template hash it writes to the selector.
Why keep the old pods for 30 seconds after the switch?
So an abort right after the switch is instant, with no new pods to start.
What does blue-green cost compared with canary?
A full second copy of the app while a release waits.
Where module 03 leaves you: Dev runs blue-green: 6.9.0 on 2 pods behind checkout-dev.localtest.me, and preview-checkout-dev.localtest.me shows the next version whenever one is waiting.