Question

Difficulty: MediumRelease Management and Deployment Strategies (Blue-Green, Canary, Rolling)

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?

  1. 1Apply non-destructive, additive database migrations (Expand phase) to support both the existing and updated schema versions simultaneously.
  2. 2Deploy the new application version (Green environment) on GKE alongside the existing running version (Blue environment) without routing live production traffic to it.
  3. 3Update the Cloud Load Balancing backend service configuration to switch 100% of incoming production traffic from the Blue environment to the Green environment.
  4. 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

1
Apply additive schema migrations (Expand phase)
The database schema supports both the current schema columns/tables and the new required columns/tables simultaneously.
Applying database migrations additively ensures that currently running instances (Blue) do not fail when querying the database while the database is updated.
2
Deploy the Green application environment
The new version of the microservice runs on GKE in parallel with the Blue version without receiving live customer traffic.
Deploying Green instances in isolation allows internal health checks and smoke testing against the expanded database schema before user traffic is introduced.
3
Shift production traffic to the Green environment
Cloud Load Balancing routes all incoming user requests to the Green pods.
Switching traffic at the load balancer level instantly shifts user traffic to the validated Green version while keeping the Blue environment idle as an immediate rollback target if needed.
4
Execute destructive schema migrations (Contract phase)
Deprecated database columns and tables are removed, and the Blue application environment is decommissioned.
Removing deprecated columns can only occur after all dependencies on the old schema are removed and the old Blue application instances are turned off.

Key Concept

Expand-Contract Database Migration with Blue-Green Deployments
Rate this question