Immutable & mutable infrastructure

Example:

  • you add a database to your infrastructure: k8s, VM, VPC, and + database
  • and scale it 1000 times

Mutable approach - environment (configuration) drift Move the infrastructure from V1 to V2 with a mutation custom script

  • 99% it is working, but 1% failing in a limbo state
  • existing environment no longer matching what we have in our automation
  • to debug you would have to:
    • wipe out the entire environment
    • redeploy V1
    • run those scripts
  • when moving to scale it becomes incredibly hard to maintain

Immutable approach - a new environment alongside the old one

  • when they are both working you bring down the older version
  • it is expensive (V1 and V2 are running at the same time)
  • but it's a best practice to ensure that your infrastructure can scale