Be Software Architecture Wise
Be Wise Apps

Leer en español · Lire en français · Auf Deutsch lesen

Chapter 10 of 12 · Intermediate to advanced

Cloud-Native and Infrastructure Architecture

Where and how software runs is now an architectural decision. This chapter covers cloud service and deployment models and the shared responsibility model, containers and Kubernetes, the twelve-factor app, infrastructure as code and GitOps, CI/CD pipelines and deployment strategies, multi-region design, disaster recovery and edge computing, platform engineering, and FinOps and vendor lock-in. It is for developers and architects who know the operational qualities of Chapter 9 and want to choose, justify and run the platforms their systems depend on, without being sold a stack.

Video introduction to Chapter 10

7 min · narrated, with captions
Listen only (audio)
Read the transcript

Welcome to Chapter 10, Cloud-Native and Infrastructure Architecture. For most of the history of software, infrastructure came after the architecture: an operations team received a finished application and found servers to run it on. That separation has gone. Today the choice between virtual machines, containers, platforms and functions decides much of the cost. The number of availability zones and regions decides the availability. And the deployment pipeline decides how quickly and safely a team can change anything.

This chapter is for developers and architects who want to choose, justify and run the platforms their systems depend on, without being sold a stack. It builds on Chapter 0, which introduced servers, virtual machines, containers, cloud service models, regions and availability zones, and on Chapter 9, which explained how to make systems scale, degrade gracefully and stay observable. Here those ideas meet the platforms most systems now run on. Decisions about where and how software runs are expensive to reverse, they cut across every team, and they fix the quality attributes that Chapter 2 asked you to specify. And Chapter 11 follows, with how to judge an architecture, including its infrastructure, and how to change it safely over time.

The running example is the food delivery platform used throughout the course: customer and restaurant apps, an order service, menus, payments, courier dispatch, and a sharp evening rush. The first four sections are about the foundations. Section ten point one sets out who manages what, from infrastructure as a service, or IaaS, through PaaS and functions, to SaaS. Under the shared responsibility model, your data, identities and configuration are always your job. Section ten point two explains container images, the Kubernetes control plane and nodes, and the reconciliation loop at its heart. It is also honest about when Kubernetes is overkill. Section ten point three walks through all twelve factors of the twelve-factor app, with modern caveats, and shows how to audit an existing service against them. Section ten point four covers infrastructure as code: declarative tools, state and drift, modules, immutable infrastructure, GitOps, policy as code and testing.

The single most important idea in this chapter is declared desired state, continuously reconciled by automation. This diagram from Section ten point two shows how Kubernetes does it. You declare the desired state. Here, three replicas of version two point four of the orders service. A controller observes the actual state of the cluster, and finds only two pods running. It compares what it sees with what was declared, and finds one pod missing. So it acts, and asks for one new pod. The loop repeats on every change event, and periodically. Because it acts on the current difference, not on a remembered sequence of events, missed events and restarts do no lasting harm. The same idea runs through infrastructure code, GitOps, deployment pipelines and immutable infrastructure. A person changes a description, which is reviewed, versioned and auditable, and machines do the rest.

The second four sections are about change, scale, people and money. Section ten point five follows a change from commit to production through a CI/CD pipeline, compares rolling, blue-green, canary and shadow deployments, and separates deployment from release with feature flags. Section ten point six compares disaster recovery strategies, explains what replicating data across regions does to consistency, and covers cell-based architecture and edge functions. Section ten point seven treats the internal developer platform as a product, with golden paths and guardrails, and shows how to measure whether it helps. And Section ten point eight turns cost into an architectural quality, measured per order, and treats vendor lock-in as a trade-off to be priced rather than a sin to be avoided.

The second idea is that every option in this chapter is a trade-off. This diagram from Section ten point six shows four disaster recovery strategies side by side. Each is judged by two numbers that come from the business: the recovery time objective, or RTO, how long you may be down, and the recovery point objective, or RPO, how much data you may lose. With backup and restore, backups are copied to a recovery region where nothing runs. Recovery takes hours, and you lose everything since the last backup. With a pilot light, data is replicated but the application servers are off. With a warm standby, a small working copy already runs and scales up. Recovery time falls to tens of minutes, then to minutes. With active-active, a full second region is already serving traffic, and both numbers are near zero. Each step to the right buys faster recovery and less data loss, at a higher continuous cost and complexity. The right choice depends on the workload and the organisation.

By the end of the chapter, you will be able to compare the cloud service and deployment models, and assign the duties for a workload under the shared responsibility model. You will understand how Kubernetes maintains a declared desired state, and be able to judge when it is overkill. You will be able to choose between rolling, blue-green, canary and shadow deployments, and use feature flags to separate deployment from release. And you will be able to calculate unit costs, such as cost per order, and evaluate lock-in as a priced trade-off.

Each section can be read on its own, but the order is deliberate. You cannot reason about deployment strategies without knowing what Kubernetes does during a rollout. If you are new to operations, read the beginner boxes, and Chapter 0's section on servers and the cloud, first. Don't worry about memorising tool names. Products change every few years, while the mechanisms last. Vendors are named as examples, not recommendations. At the end of each section there are self-check questions. Answer them in your head before you look at the answers. Allow about three hours to read the whole chapter. When you are ready, there is an optional chapter test of about forty five minutes, with twenty multiple choice questions and two written answers. The pass mark is eighty per cent.

That is the shape of the chapter. Start with Section ten point one, on cloud service and deployment models, and who is responsible for what. See you there.

Download chapter (PDF)Read in the app

At a glance

You will learn to

  • Compare IaaS, CaaS, PaaS, FaaS and SaaS and the deployment models, and assign duties for a workload under the shared responsibility model.
  • Explain how Kubernetes maintains a declared desired state through its control plane, nodes and reconciliation loops, configure requests, limits and probes, and judge when Kubernetes is overkill.
  • Audit an application against the twelve factors and the principles beyond them, and prioritise the fixes by risk.
  • Design infrastructure code with remote state, locking, modules, environments, policy checks, tests and GitOps reconciliation.
  • Choose a deployment strategy (rolling, blue-green, canary or shadow) and separate deployment from release with feature flags.
  • Select a disaster recovery strategy from RTO, RPO and cost, and explain the consequences of replicating data across regions and moving work to the edge.
  • Explain how an internal developer platform with golden paths reduces cognitive load, and how to measure whether it succeeds.
  • Calculate unit costs such as cost per order, identify the architectural drivers of cloud cost and evaluate lock-in as a priced trade-off.

Before you start

Chapter 0, section 0.7 (servers and the cloud) and section 0.8 (how software gets built); Chapter 9, especially scaling, statelessness, SLOs and observability. Chapter 6 on distributed systems helps.

Time

About 3 hours to read; 45 minutes for the test.

Key terms

cloud native · shared responsibility model · availability zone · container image · Kubernetes · reconciliation loop · twelve-factor app · infrastructure as code · GitOps · canary release · RTO and RPO · golden path · FinOps · lock-in

Why infrastructure has become architecture

For most of the history of software, infrastructure was something that happened after the architecture: an operations team received a finished application and found servers to run it on. That separation has gone. In a modern system, the choice between virtual machines, containers, platforms and functions decides much of the cost; the number of availability zones and regions decides the availability; the deployment pipeline decides how quickly and safely a team can change anything; and the infrastructure itself is written as code, reviewed in pull requests and versioned with the application. Decisions about where and how software runs are now among the most significant an architect makes, in exactly the sense of Chapter 1: they are expensive to reverse, they cut across every team and they fix the quality attributes that Chapter 2 asked you to specify.

This chapter builds on two earlier ones. Chapter 0 introduced servers, virtual machines, containers, cloud service models, regions and availability zones (servers and the cloud). Chapter 9 explained how to make systems scale, degrade gracefully and stay observable (scaling strategies onwards). Here those ideas meet the platforms that most systems now run on. The running example is the food-delivery platform used throughout the course: customer and restaurant apps, an order service, menus, payments, courier dispatch and a sharp evening rush.

How the sections fit together

The first four sections are about the foundations. Cloud service and deployment models sets out who manages what under IaaS, containers as a service, PaaS, FaaS and SaaS, the shared responsibility model, the real reasons for private, hybrid and multi-cloud, what the CNCF means by cloud native, and when renting is not cheaper than owning. Containers and orchestration explains images and the OCI standards, the Kubernetes control plane and nodes, its core objects and the reconciliation loop at its heart, with real YAML, and is honest about when Kubernetes is overkill. The twelve-factor app walks through all twelve factors with modern caveats, the principles beyond them, and an audit of an existing service. Infrastructure as code covers declarative tools (Terraform, OpenTofu, CloudFormation, Bicep, Pulumi), state, drift, modules, immutable infrastructure, GitOps, policy as code and testing.

The second four sections are about change, scale, people and money. CI/CD pipelines and deployment strategies follows a change from commit to production, compares rolling, blue-green, canary and shadow deployments, and separates deployment from release with feature flags. Multi-region, disaster recovery and edge computing compares disaster recovery strategies by RTO, RPO and cost, explains the consistency consequences of replicating data across regions, and covers cell-based architecture and edge functions. Platform engineering treats the internal developer platform as a product with golden paths and guardrails, and shows how to measure whether it helps. FinOps, cost architecture and lock-in turns cost into an architectural quality, measured per order, and treats vendor lock-in as a trade-off to be priced rather than a sin to be avoided.

Each section can be read on its own, but the order is deliberate: you cannot reason about deployment strategies without knowing what Kubernetes does during a rollout, or about platform engineering without infrastructure code and pipelines to build the platform from.

One idea runs through every section

The single most important idea in this chapter is declared desired state, continuously reconciled by automation. Kubernetes keeps the number of running copies equal to the number you declared. Infrastructure code describes networks and databases, and a tool computes and applies the difference from what exists. GitOps keeps the cluster equal to what is in a Git repository. A deployment pipeline turns every change into the same tested, repeatable sequence of steps. Immutable infrastructure replaces rather than repairs. In each case a person changes a description, which is reviewed, versioned and auditable, and machines do the rest. This is what lets a small team operate a large system safely: change becomes routine, and recovery becomes a rerun rather than an act of heroism.

The second idea is that every option on this chapter's menu is a trade-off, and the right choice depends on the workload and the organisation. Kubernetes is excellent for many services and many teams and wasteful for three services and two developers. Multi-region active-active buys minutes of recovery time at a multiple of the cost. A platform team helps only if developers want what it builds. Cloud is cheapest for variable load and can be beaten by owned hardware for large, steady load. Lock-in is a cost to be weighed against the cost of portability. The chapter therefore gives you decision guides, worked examples with numbers and the arguments on both sides, rather than a single recommended stack.

How to use this chapter

Readers new to operations should read the beginner boxes and Chapter 0's section on servers and the cloud first, and should not worry about memorising tool names: products change every few years, while the mechanisms (reconciliation, immutability, state and drift, progressive delivery, recovery objectives, unit costs) last. Experienced engineers may want to start with the worked examples and the decision guides, then read the sections whose trade-offs they disagree with. Throughout, vendors such as AWS, Microsoft Azure, Google Cloud and Cloudflare are named as examples, not recommendations.

Chapter 11 follows with evaluation, governance and modernisation: how to judge an architecture, including its infrastructure, and how to change it safely over time.

The 8 sections

10.1 · Intermediate · 22 minCloud modelsIaaS, CaaS, PaaS, FaaS and SaaS, public, private, hybrid and multi-cloud, shared responsibility, zones and managed services, what cloud native means, and when renting is not cheaper.Read →10.2 · Advanced · 25 minContainers and KubernetesImages, layers, registries and the OCI standards; why orchestration is needed; the Kubernetes control plane, nodes, core objects and reconciliation loops; requests, limits, probes, and when Kubernetes is overkill.Read →10.3 · Intermediate · 20 minTwelve-factorAll twelve factors with what each means, why it matters and where it has aged; the principles beyond them (disposability, immutability, observability, security); and a worked audit of an existing service with prioritised fixes.Read →10.4 · Advanced · 24 minInfrastructure as codeDeclarative and imperative infrastructure code; Terraform, OpenTofu, CloudFormation, Bicep and Pulumi; state, locking, drift, modules and environments; immutable infrastructure; GitOps; policy as code; and how to test it all.Read →10.5 · Intermediate · 22 minCI/CD and deploymentHow a change travels from commit to production: pipeline stages, build once and deploy many, trunk-based development, rolling, blue-green, canary and shadow deployments, feature flags, migrations and rollback.Read →10.6 · Advanced · 24 minMulti-region and edgeWhen and how to run across regions: latency, disaster recovery and data residency, the four DR strategies with RTO, RPO and cost, cross-region data, failover, cells for blast radius, CDNs and edge functions.Read →10.7 · Intermediate · 21 minPlatform engineeringWhy organisations build internal developer platforms, golden paths and Backstage, running the platform as a product with self-service and guardrails, reducing cognitive load, measuring success with DORA and SPACE, and avoiding the common traps.Read →10.8 · Intermediate · 22 minFinOps and lock-inTreating cost as an architectural quality: FinOps phases, unit economics such as cost per order, common cost drivers, commitments and spot, tagging, showback and chargeback, and lock-in as a deliberate trade-off with an exit strategy.Read →

Chapter test

Test your understanding of Chapter 10

Optional: 20 multiple-choice questions and 2 short written answers, drawn afresh from a bank of 72 questions. Pass mark 80%. Passing every chapter test, then the final assessment, earns the Be Wise Certificate of Completion.

Take the Chapter 10 test in the app

Further reading