Skip to main content
mid
intermediate
CI/CD

Blue-Green Deployment Strategy

Question

What is a blue-green deployment, and what are its advantages and disadvantages compared to other deployment strategies?

Answer

Blue-green deployment maintains two identical production environments (blue and green). One serves live traffic while the other receives the new version. After testing, traffic switches to the updated environment. Advantages: instant rollback, zero downtime, and safe testing. Disadvantages: requires double resources and can be complex with databases.

Why This Matters

Blue-green deployments provide a safety net for releases by keeping the previous version running until the new one is verified. This strategy is particularly valuable for critical applications where downtime or failed deployments have significant business impact.

Code Examples

Kubernetes blue-green with services

yaml

Switch traffic to green

bash
Common Mistakes
  • Not accounting for database schema changes that may break the old version
  • Forgetting to warm up the new environment before switching traffic
  • Not having proper health checks to verify the green environment before cutover
Follow-up Questions
Interviewers often ask these as follow-up questions
  • How do you handle database migrations in a blue-green deployment?
  • What is the difference between blue-green and canary deployments?
  • How would you implement blue-green deployments with AWS or other cloud providers?
Tags
cicd
deployment
devops
release-management
zero-downtime