Delivery and rollback
Delivery and rollback
A safe delivery process treats rollout as a reversible change to a versioned artifact and verifies the service contract throughout.
Build once and promote the same reviewed artifact digest. Record dependency lockfiles, SBOM, provenance, scans, tests and target configuration; review the migration and rollback boundary. RollingUpdate maxUnavailable and maxSurge constrain planned availability and extra pods; percentages are rounded down and up respectively. They do not guarantee zero downtime, since readiness, resource limits and unexpected failures matter. A canary needs representative traffic and a predeclared observation window and stop rule. A rollback to a previous Deployment revision changes the pod template; it does not undo a database migration, external side effect, or ConfigMap edited in place. Use backward-compatible expand/contract schemas while old and new binaries coexist; defer destructive changes until the old version is retired and data recovery is reviewed. Use explicit image digests and versioned config, protect persistent data, and maintain tested restore plans. Kubernetes rollout status and rollback commands are documented only for an approved isolated namespace in the companion lab. No cluster or real traffic is used in the examples.
Baseline: .NET 10 / C# 14. All C# results below are reasoned, not executed. Synthetic calculations are not performance measurements.
Calculate a planned rolling capacity envelope
Three replicas, maxUnavailable 0 and maxSurge 1. This is an arithmetic model, not an actual scheduler.
Inspect the archived Fixture.csproj and use only an approved .NET 10 SDK. Build and run in an isolated lab with finite time and resource limits.
using System;int replicas=3, unavailable=0, surge=1;Console.WriteLine($"planned available floor={replicas-unavailable}");Console.WriteLine($"planned replica ceiling={replicas+surge}");Expected result (not executed):
planned available floor=3planned replica ceiling=4Terminating pods can temporarily consume additional resources; failures may reduce availability. The envelope is not a guarantee of actual counts.
Make a canary decision from fictional observations
Stop when errors exceed the declared budget or the sample is too small to promote.
Inspect the archived Fixture.csproj and use only an approved .NET 10 SDK. Build and run in an isolated lab with finite time and resource limits.
using System;static string Decide(int requests, int errors) => requests < 1000 ? "hold" : errors*1000L > requests ? "stop" : "candidate";foreach (var sample in new[]{ (Requests:100, Errors:0), (Requests:1000, Errors:3), (Requests:1000, Errors:1) }) Console.WriteLine(Decide(sample.Requests,sample.Errors));Expected result (not executed):
holdstopcandidateThe synthetic threshold is at most 0.1% errors over at least 1,000 requests. Promotion also needs latency, saturation and business invariants; this simple model is not a statistical confidence test.
Reject an incompatible rollback
Model whether an older binary can operate on the current schema.
Inspect the archived Fixture.csproj and use only an approved .NET 10 SDK. Build and run in an isolated lab with finite time and resource limits.
using System;foreach (var schema in new[]{ (Name:"expanded", LegacyColumn:true), (Name:"contracted", LegacyColumn:false) }) Console.WriteLine($"{schema.Name}: {(schema.LegacyColumn ? "old binary eligible for tests" : "rollback blocked")}");Expected result (not executed):
expanded: old binary eligible for testscontracted: rollback blockedColumn presence is necessary in this model, not sufficient for compatibility. Actual read/write tests and data recovery are required.
Apply the concept
Plan a rolling update of four replicas using maxUnavailable 25% and maxSurge 25%. A new version introduces a new nullable column. Specify a rollback gate and what to do if the old column is later removed.
Use the manual practice and knowledge check. Do not deploy or publish these fixtures.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Delivery and rollback — knowledge check
Apply the lesson concepts to the following scenarios.
What is promoted across environments?
What does rolling back a Kubernetes Deployment revision restore?
What is maxSurge?
Why keep an expanded schema compatible?
When should a canary promote?