← Back to microservices patterns map
🏗️
Microservices Pattern

Immutable Infrastructure

Never patch running instances; build a new image and replace them.

deploy

Detailed Description

Immutable infrastructure makes production match the artifact built and tested in CI.

Rollback means redeploying a known previous image, not manually undoing server changes.

Avoid SSH patching or manual hotfix drift on running hosts; replace nodes/images instead.

Pair with GitOps or declarative deployment pipelines so desired state and runtime state stay aligned.

Treat runtime as disposable: build once, promote through environments, and replace predictably.

Visual Diagram

Mutable (old way)
  Server → SSH in → apt update → patch
  (drift: servers become snowflakes)

Immutable (correct)
  Code change → build new Docker image
  → push to registry
  → deploy new pods
  → terminate old pods
  Every deployment is predictable

Tradeoffs

Pros

Predictable deployments, no configuration drift

Cons

Requires strong build and release pipeline

Examples: Docker, Kubernetes, Packer AMIs, GitOps with ArgoCD
Exact HTML content was not provided for this deployment pattern.