Highlights

Contents

BACKEND ENGINEERING / UNIT XV / FIELD GUIDEDeployment andthe full requestContainers, Kubernetes, safe releases and one request end to endv812v812v813ship it, then follow itContainersimages, namespaces, PID 1Kubernetespods, Services, HPAReleasescanary, migrations, flagsThe requestDNS to database and back
Before we start

How to read this chapter

Every earlier unit assumed that Wren’s code was already running somewhere, on four instances, behind a load balancer, able to be replaced. This unit explains how that happens, from a Dockerfile to a pod that Kubernetes starts, probes, scales, drains and replaces, and how a new version reaches users without anyone noticing. It ends by following one request through everything in the series.

Part I opens containers, images, namespaces, cgroups and PID 1. Parts II and III cover the Kubernetes objects a backend engineer meets and how the cluster schedules, restarts and scales them. Part IV is graceful shutdown. Parts V and VI cover deployment strategies and the compatibility rules that make zero-downtime releases possible, including database migrations. Part VII is feature flags. Part VIII weighs monoliths against microservices. Part IX is about what all of this costs. Part X is the capstone, GET /orders/123 from the phone to the database and back, with the questions an interviewer can interrupt with at every hop.

Each section starts from a Wren situation, explains the mechanism, works the numbers and then shows a figure. Picture this boxes give analogies, notes add detail, Watch out names real mistakes, and Interview lens gives an answer to say aloud. In one breath closes each part.

By the end you should be able to write a production Dockerfile, read a Deployment manifest and predict how a rollout will behave, shut a service down without dropping requests, choose a release strategy, change a database schema with no downtime, and walk an interviewer through a request end to end.

The running system

Meet Wren

Wren is the illustrative food-ordering service from earlier units. These are the numbers this unit uses. All are assumptions chosen for readable arithmetic, not measurements, and prices are illustrative list prices.

Setting Value What it controls
Orders service 4 replicas, requests 500m CPU and 1 GiB, limit 1 GiB Scheduling
Nodes 8 vCPU, 32 GiB each Packing
Autoscaling target 60% CPU, 4 to 20 replicas HPA
Rollout maxSurge 25%, maxUnavailable 25% Rolling update
Termination grace 30 s, with a 5 s pre-stop pause Graceful shutdown
Canary 5% of traffic for 10 minutes Release safety
Peak traffic 2,000 requests/s, 2,000-byte responses Egress cost
Logs 86.4 GB a day, Unit XIV Logging cost
Sample request GET /orders/123 by user 42 The capstone
The map

What is inside

How code becomes a running, replaceable process, and how every unit of the series meets in one request.

CHAPTER ATLAS / FOLLOW THE READING PATHCHAPTER ATLAS / FOLLOW THE READING PATH1Containers2Kubernetes objects3Scheduling, probes andautoscaling4Graceful shutdown5Deployment strategies6Compatibility andzero-downtime migrations7Feature flags8Monoliths andmicroservices9Cost-aware backendengineering10The full request
  1. 01ContainersSections 1 to 4. We look at what a container actually is, an ordinary Linux process with a private view of the system and a limit on what it can use.
  2. 02Kubernetes objectsSections 5 to 8. We learn the handful of Kubernetes objects that a backend engineer writes and reads every week.
  3. 03Scheduling, probes and autoscalingSections 9 to 11. We look at how Kubernetes decides where each pod runs, what happens when a pod misbehaves, and how the number of pods follows traffic.
  4. 04Graceful shutdownSections 12 to 13. We stop a running instance without failing any of the requests or jobs it is handling.
  5. 05Deployment strategiesSections 14 to 17. We get new code from a merged pull request to users without downtime, and with a fast way back if it is wrong.
  6. 06Compatibility and zero-downtime migrationsSections 18 to 19. We learn the rules that let two versions of a service run side by side, which every strategy in Part V quietly assumes.
  7. 07Feature flagsSections 20 to 21. We separate deploying code from releasing behaviour, so new features can be turned on gradually and off instantly.
  8. 08Monoliths and microservicesSections 22 to 24. We weigh one deployable application against many small services, without the slogans that usually surround the choice.
  9. 09Cost-aware backend engineeringSections 25 to 26. We learn where a backend's cloud bill comes from and how to read it.
  10. 10The full requestSections 27 to 31. We follow GET /orders/123 from user 42's phone to the database and back, through every layer this series has covered.
  11. +Interview prepInterview question bank, graded exercises and worked solutions.