liveBook · Manning

Blue-green deployment

As explained in Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform

Blue-green deployment is a release technique that runs old and new application versions in parallel and switches traffic between them.

Blue-green deployment reduces rollout risk by keeping two production environments available. Customers use one environment while developers build and test changes in the other, then traffic moves through a DNS switch. section 4.4.5 section 12.4.5

A practical blue-green rollout follows this cycle:

  • Route the customer-facing domain, such as www.company.com, to the blue environment. section 12.4.5
  • Create or update the green production environment for risky, experimental, or infrastructure changes. section 12.4.5
  • Test the green environment before directing customers to it. section 12.4.5
  • Switch DNS to green, and reverse the switch to blue if the new environment fails. section 4.4.5 section 12.4.5

A reversible infrastructure rollout

Customers remain on blue while developers and testers work on green. After green is tested, DNS sends customers there; blue then becomes the next environment for development. If green exposes a problem, DNS returns customers to blue. section 12.4.5

Figure 12.19 Customers use the blue environment, while developers and testers work with the green environment.

Shows the separation between the customer-facing blue environment and the green environment used by developers and testers. section 12.4.5

Figure 12.20 When the green environment is ready and tested, customers are switched over to it. Developers and testers then switch to the blue environment and continue working. When the blue environment is ready and tested, customers switch again, and the cycle continues.

Shows the tested-environment handoff and the continuing cycle of switching customer traffic between blue and green. section 12.4.5

How Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform covers it

How deep it goes
Defines environments, DNS switching, testing, rollback, and repeated handoffs, but does not detail implementation commands.
Examples
Uses blue and green production environments, www.company.com DNS routing, and recurring environment handoffs.
What it assumes
Assumes parameterized Terraform environments and DNS routing; keeps application data outside cluster storage.
What you can do after
Operate/configure reversible production rollouts by testing a parallel environment and switching DNS with a rollback path.
How it connects
Connects Terraform, DNS, Kubernetes, cloud storage, and stateless infrastructure.

Also explained in

Compare how 5 books explain blue-green deployment →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform. The section links point to the parts of the book it draws on.