An e-commerce platform hosted on Google Kubernetes Engine (GKE) backed by Cloud SQL for PostgreSQL is executing a zero-downtime release for its order processing microservice. The update introduces breaking database schema changes. To maintain service availability throughout the rollout, the engineering team must combine an Expand-Contract database migration pattern with a Blue-Green deployment strategy.
Which sequence represents the correct chronological order of steps from FIRST to LAST to safely execute this zero-downtime deployment?
- 1Apply non-destructive, additive database migrations (Expand phase) to support both the existing and updated schema versions simultaneously.
- 2Deploy the new application version (Green environment) on GKE alongside the existing running version (Blue environment) without routing live production traffic to it.
- 3Update the Cloud Load Balancing backend service configuration to switch 100% of incoming production traffic from the Blue environment to the Green environment.
- 4Execute destructive database cleanup operations (Contract phase) to remove obsolete columns and tables once the Blue environment is fully decommissioned.
Answer
The correct sequence of steps is: 1) Apply non-destructive additive database migrations (Expand phase); 2) Deploy the new application version (Green environment) on GKE; 3) Update Cloud Load Balancing to shift live traffic to the Green environment; 4) Execute destructive database cleanup operations (Contract phase).
Executing a zero-downtime release with breaking database schema changes requires an Expand-Contract pattern combined with Blue-Green deployment. First, the database is expanded with additive, backward-compatible schema modifications so both old and new code versions can run. Second, the new Green application version is deployed alongside the Blue version. Third, traffic is shifted at the Cloud Load Balancer level from Blue to Green. Fourth, once the Blue version is safely drained and stopped, destructive schema cleanups (Contract phase) remove deprecated database fields.
Step-by-Step Solution
Key Concept
Expand-Contract Database Migration with Blue-Green Deployments