Blue-Green deployment — strategy with two identical production environments: Blue (current live) and Green (new version). Load balancer switches 100% of traffic to Green for deploy, revert instantly if anything breaks. Plus: zero downtime, instant rollback. Minus: double infrastructure cost during deploy, DB schema migrations are tricky (both versions must work on same DB).
Below: details, example, related terms, FAQ.
# nginx load balancer switch
upstream backend {
server 10.0.0.1:8080; # Blue
# server 10.0.0.2:8080; # Green (commented until deploy)
}
# After deploy: swap comments, nginx -s reloadRolling: update pods one at a time (K8s default). Blue-green: 2 full envs + swap. Blue-green safer for stateful, rolling simpler for stateless.
During deploy — yes (hours). Not needed permanently — create Green at deploy time, destroy after success.
Schema must be backwards-compatible (no drop columns, no rename). Forward-compatible: add nullable columns, defaults.