CI/CD · Ship safely, repeatedly

How does blue-green deployment work?

Mediumblue-greendeploymenttrafficUpdated Oct 2026
Quiz this track

Short answer

Blue-green runs two identical environments. You deploy to the idle one, verify it, then switch traffic from the old version to the new one. The old environment stays available for a fast rollback.

The switch is usually at a load balancer, DNS or service selector. Because the old environment is still running, rollback is a traffic switch back rather than a rebuild or redeploy.

  • Provision or maintain two environments with the same configuration shape
  • Deploy and test the new version on the idle side
  • Switch traffic atomically and watch error rates and latency
  • Keep the previous version warm until the verification window passes
  • Tear down or reuse the old side after the rollback window
yaml
apiVersion: v1
kind: Service
metadata:
  name: checkout
spec:
  selector:
    app: checkout
    version: green
  ports:
    - port: 80
      targetPort: 8080
Switching the selector moves traffic while both versions remain running.
Blue-green does not solve database compatibility. Both versions may run during the switch, so schema changes must be backward compatible and long-running transactions must drain.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1What does the traffic switch usually look like?
  2. 2How do you handle database changes in blue-green?
  3. 3What is the cost trade-off?
  4. 4How long do you keep the old environment running?

Say it in the interview

Blue-green runs two identical environments and deploys the new version to the idle one. After verification I switch traffic over and keep the old environment running as the rollback target. The main advantages are a fast switch and a clean rollback. The constraints are duplicate capacity and database compatibility, since both versions may run briefly during the cutover.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live CI/CD mock interview and get scored feedback on depth, clarity and confidence.