22 / 25 · Operations and recovery

Zero-downtime deployments

A zero-downtime deployment aims to release a change without interrupting required user operations. Rolling or blue-green rollout helps, but database compatibility, readiness and connection draining are part of the design.

Trace a rolling deployment that aims to keep four replicas available while a replacement starts. Check spare capacity, readiness, connection draining and database compatibility before releasing a new version.

What you will practise

  • Trace a rollout
  • budget extra capacity
  • use expand/contract

Before you start: Readiness, old/new versions and schema compatibility.

About 4 minutes · offline-generated English female narration · captions included. Diagrams are conceptual; timings are illustrative.

Download MP4Captions

Listen without the videoDownload audio

The same pre-recorded voice as the video. Starting audio pauses the video, and starting the video pauses audio.

Chapters and full transcript

Let us understand zero-downtime deployments. A school repairs one classroom while students use another ready room. Moving students before the new room has desks causes disruption. Throwing away the old room key before every class moves makes rollback difficult. Old and new arrangements must coexist safely during the transition. A zero-downtime deployment aims to release a change without interrupting required user operations. Rolling or blue-green rollout helps, but database compatibility, readiness and connection draining are part of the design.

Follow the normal path. Visitors use the existing version while the next release is prepared. Establish user-visible metrics and rollback conditions before shifting traffic. Create new capacity without immediately removing all old instances. Download, initialization and dependency setup take time and need spare resources. SeatSpot must release a booking API while active users and old mobile clients remain. New code and old code may run simultaneously against the same data.

Now change one condition. The readiness gate verifies the instance can serve the intended request. A running process with missing dependencies should not receive normal traffic yet. A common misunderstanding is this: maxUnavailable: 0 guarantees the whole application is correct. It expresses a rollout constraint; readiness, data compatibility and spare capacity remain necessary. Think about this. Old code still reads a column while new code deploys. Can you drop that column immediately? Pause the video and make your prediction. No. Keep old/new versions compatible during coexistence and rollback. Remove obsolete structures only after the transition is proven safe.

Let us reason with a concrete example. Four replicas must remain available; one replacement is created before one old replica is removed. The rollout temporarily needs capacity for five. If no spare capacity exists, readiness and rollout policy can stall. This simple count excludes node limits and dependency capacity. Test old/new coexistence and rollback with real requests. Treat zero downtime as a measured release goal, not an unconditional Kubernetes flag. These figures are teaching examples, not production guarantees.

Turn the idea into a design decision. Send a bounded share to the new version and drain old work deliberately. Monitor errors and latency for real user operations, not only process health. Both versions can access the database during rollout. Expand and migrate safely before removing fields or behavior the old version still needs. When you try the practice task, look for this result. Rolling back code does not automatically reverse a destructive data migration.

Check your understanding. Stop or reverse traffic movement if the release violates its criteria. Code rollback cannot magically reverse incompatible or destructive data changes. Here is a challenge. Version B renames a database field and Version A still runs. What safer migration sequence can you use? Pause before the answer. Expand with the new field, implement compatible reads/writes, backfill and validate, switch traffic/readers, then contract only when old users are gone. Plan failure/rollback at each step. For an interview, discuss surge capacity, draining and compatible schemas. Say what you would measure, not only which tool you would buy.

Start with an everyday picture

A school repairs one classroom while students use another ready room. Moving students before the new room has desks causes disruption. Throwing away the old room key before every class moves makes rollback difficult. Old and new arrangements must coexist safely during the transition.

Why SeatSpot needs this

SeatSpot must release a booking API while active users and old mobile clients remain. New code and old code may run simultaneously against the same data.

Trace one step at a time

Move through the diagram at your pace. Teal paths are active; unavailable components are labelled.

TrafficOld versionNew versionReadiness gateCompatible DB

Step 1 of 6 · Baseline behavior

Serve the old version

Visitors use the existing version while the next release is prepared. Establish user-visible metrics and rollback conditions before shifting traffic.

Read all six mechanism steps
  1. Serve the old version

    Visitors use the existing version while the next release is prepared. Establish user-visible metrics and rollback conditions before shifting traffic.

  2. Start the replacement

    Create new capacity without immediately removing all old instances. Download, initialization and dependency setup take time and need spare resources.

  3. Check readiness

    The readiness gate verifies the instance can serve the intended request. A running process with missing dependencies should not receive normal traffic yet.

  4. Shift traffic gradually

    Send a bounded share to the new version and drain old work deliberately. Monitor errors and latency for real user operations, not only process health.

  5. Keep data compatible

    Both versions can access the database during rollout. Expand and migrate safely before removing fields or behavior the old version still needs.

  6. Validate rollback

    Stop or reverse traffic movement if the release violates its criteria. Code rollback cannot magically reverse incompatible or destructive data changes.

Pause and make a prediction

Old code still reads a column while new code deploys. Can you drop that column immediately?

Answer aloud or write your reasoning in the lesson notes before revealing the explanation.

Correct a common misunderstanding

Claim to question: maxUnavailable: 0 guarantees the whole application is correct.

Better explanation: It expresses a rollout constraint; readiness, data compatibility and spare capacity remain necessary.

Stage an expand/contract rollout

A paper or whiteboard task. No cloud account or paid infrastructure is required.

  1. Add a compatible new field without removing the old one.
  2. Migrate/backfill, switch readers/writers and monitor.
  3. Remove the obsolete representation in a later verified release.

Check what you can explain

This is your self-check, not an automated grade. Try again without the diagram tomorrow.

0 of 3 goals checked. Choose one remaining idea to practise next.

These checkboxes reset when you leave. Use your saved lesson notes and completion marker to record lasting progress.

Teach it back

Without looking, explain what this component changes, what it does not solve and what happens if it fails. Use the animation to check your explanation, then switch to Engineering.

Try it before viewing the solution

Version B renames a database field and Version A still runs. What safer migration sequence can you use?

Check one key idea

maxUnavailable: 0 guarantees:

Your explanation and interview notes

Saved only in this browser when storage is available. Export a backup from the course page before clearing browser data or moving devices.

Loading your local notes…

Official references and next reading

The explanation, fictional examples and animations are original teaching material. Vendor behavior depends on the specific product/version; use its documentation before deploying.