I'm weighing a standard rolling update against blue-green for a web app with a backend. Could I switch traffic by changing a Service selector, and would rollback really be clean if both versions share a database?
When is blue-green worth it over rolling updates in Kubernetes?
Answers
For a straightforward web and backend app, I'd start with rolling updates and good readiness probes. You avoid keeping a full second set of capacity around, and the deployment gradually replaces old pods with new ones.
The catch is that old and new versions run at the same time. Your frontend, backend, and database changes need to tolerate that overlap. Blue-green can be worth the extra setup when a release needs testing as a complete set before traffic moves, or when a bad release is costly enough that a quick traffic switch matters.
Reply to this answer
A shared database is the big rollback caveat. Switching traffic back to the old pods does not undo schema changes or data written by the new version.
Use backward-compatible migrations where possible. Add the new schema first, deploy code that can work through the transition, and remove the old schema only after you no longer need to roll back. Even then, check whether data written by the new version can be understood by the old one. Blue-green helps with traffic rollback, not automatic database rollback.
Reply to this answer
Yes, a Service selector can point at one set of pods and then the other. Bring the new set up separately, check its readiness and smoke test it before changing the selector. Keep the old set available if you want a quick route back.
That is a traffic switch, not necessarily a perfectly instantaneous switch for every request. Existing connections and the way traffic reaches your services can affect the cutover. Automating the checks and switch can help, but it adds machinery to maintain.
Reply to this answer
Two components are enough to make blue-green useful. The question is whether you need to stage and test the web and backend versions together before exposing them, especially if cross-version compatibility is awkward.
Be careful about where the switch happens. If the web and backend have separate traffic paths, changing one selector does not automatically switch both as a single unit. You still need to plan for any overlap during cutover.
Reply to this answer
It doesn't have to be one strategy everywhere. You can use blue-green at the traffic boundary and still roll out changes within an environment. Pick the extra separation where it solves a real release or rollback problem rather than applying it to every component.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Nexmar+4u:
So the selector switch can get the old application serving again, but the database still has to be compatible with it?
q.953+ferrywicket:
Right. Any irreversible migration or incompatible data written after cutover can make that switch unsafe.