A step-by-step guide to setting up blue-green deployments on Kubernetes using CircleCI. Covers writing dual-environment Kubernetes manifests (blue and green Deployments plus production and preview Services), building a five-job CircleCI pipeline with an approval gate that separates deploy from release, running smoke tests against a preview Service before switching traffic, handling database migrations safely with the expand-migrate-contract pattern, and configuring instant one-click rollback from the CircleCI Deploys dashboard. Also discusses when blue-green is the right strategy versus rolling or canary deployments.
Table of contents
This tutorial covers:PrerequisitesHow blue-green deployments work in KubernetesStep 1 — Build and containerize the sample applicationStep 2 — Write the Kubernetes manifestsStep 3 — Create the CircleCI pipeline with approval gatesStep 4 — Validate the green environment before switchingStep 5 — Handle database migrations safelyStep 6 — Set up instant rollbackStep 7 — Monitor and confirm the releaseHow CircleCI enables blue-green deploymentsWhen to use blue-green (and when not to)Conclusion222 Impressions