Rollout and rollback

  • Release readiness, traffic promotion, draining and recovery limits.
Diagram phase
100%

Rolling replacement within one functional domain

Deployment controller manages old and new replica setsService selection and application readinessRolling update: old and new eligible Pods overlapRequest / responseHealth checksControl / statereconcilecreate replacementretain / reducestartold eligiblenew eligibleobservethen reduce oldA Deployment rollout changes replicas of the old and new ReplicaSets according to its configured strategy. RollingUpdate permits overlapping generations. The actual chart strategy and availability settings determine the replacement policy.RollingUpdatestrategy omittedOld Pods remain during replacement, subject to the actual surge/unavailability policy. A rollback reconstructs an earlier Pod template only if its image/artifact/configuration inputs still exist and remain compatible.Old ReplicaSetThe controller creates replacement Pods with the new Pod template. No fixed maxSurge, maxUnavailable or replica value is invented in this architecture view.New ReplicaSetThe Service normally selects ready endpoints across the matching old and new Pods during overlap. It is not an atomic application-generation switch, and an existing connection is not automatically migrated to a new Pod.Stable ServiceExisting application instances may serve traffic while new instances start. Mixed versions must tolerate shared schema, configuration, cache and protocol contracts during the rollout.Old ready PodsNew Pods become eligible only after their configured readiness conditions succeed. Image download, artifact assembly and application initialization all contribute to readiness.New PodsThe controller may reduce old replicas as the rollout progresses within its availability constraints. Readiness alone does not establish business compatibility or complete the drain of accepted requests.Readiness achievedreconcilecreate replacementretain / reducestartold eligiblenew eligibleobservethen reduce old

Select a component to trace its direct connections. Drag to pan · Ctrl + wheel or pinch to zoom.

  • A ReplicaSet keeps Pods running from one template. During a rolling update the old and new ReplicaSets can both have Ready Pods behind the same Service.
  • Two new connections can reach different application versions during the overlap. Their database and artifact versions must work together for that window.
Rollout capacity and failure cases

Rollout capacity and failure cases

Kubernetes apps/v1 and core/v1 · illustrative Proposed settings, not inspected Current values

Current source and illustrative tuning

  • Inspected chart templates omit an explicit strategy; the Kubernetes default is RollingUpdate. Installed-release overrides remain unverified.
  • The snippet below is an illustrative fragment to merge into a Deployment, not an observed OBRH setting.
  • For three desired replicas, maxSurge=1 allows one extra non-terminating replica; maxUnavailable=0 waits for replacement availability before reducing available capacity. Terminating Pods can add resource demand.
Illustrative RollingUpdate Deployment fragmentyaml
# Illustrative fragment: merge into an existing apps/v1 Deployment.
# These are teaching values, not inspected OBRH chart settings.
spec:
  replicas: 3
  minReadySeconds: 10
  progressDeadlineSeconds: 600
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0

Evaluate the capacity contract

Situation Consequence Required decision
No resources for the surge Pod It can remain Pending while old Pods serve Reserve headroom, reduce footprint or accept a different availability policy
Candidate fails readiness Replacement does not become available Diagnose the candidate; do not treat a longer timeout as a fix
Three old plus three Green replicas Blue/green can require roughly twice steady-state replica capacity Budget this per promoted domain; include startup/init/storage IO
Progress deadline expires Deployment reports stalled progress; it does not automatically roll back Release workflow decides stop, repair or compatible rollback
  • minReadySeconds=10 requires sustained readiness before availability. It is not a business-validation gate.
  • The 600-second progress deadline is illustrative.

Retain the recovery inputs

  • Keep Blue capacity and its image, common version, release files and compatible configuration through the rollback window.
  • Selector changes propagate; established connections and accepted work can remain on Blue.
  • Retire Blue only after the observed drain/retention policy permits it. A fixed sleep alone does not prove drain.
  • Rolling updates are the confirmed release behavior; generated artifacts are not proof of successful activation.
  • Effective drain/probe/worker and mixed-version contracts require validation.
Preview, promotion and rollback

Preview, promotion and rollback

Kubernetes apps/v1 and core/v1 · illustrative Proposed settings, not inspected Current values

Keep stable and preview traffic separate

  • Prerequisite: two ready Deployments labelled app=example-api, release=R1 and release=R2 in domain-a. Their complete image/artifact identities must already be validated.
  • api-active selects R1. api-preview selects R2. Neither Service creates Pods.
  • These complete illustrative Service objects do not create Deployments, a PVC or a real OBRH API implementation.
Illustrative active and preview Servicesyaml
# Illustrative prerequisites: ready R1/R2 Deployments with matching Pod labels.
# Apply only after adapting the namespace, labels and port to the workload.
apiVersion: v1
kind: Service
metadata:
  name: api-active
  namespace: domain-a
spec:
  selector:
    app: example-api
    release: R1
  ports:
    - name: http
      port: 80
      targetPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: api-preview
  namespace: domain-a
spec:
  selector:
    app: example-api
    release: R2
  ports:
    - name: http
      port: 80
      targetPort: 8080

Promote through an explicit gate

  • Run from a release runner with kubectl, curl and jq, cluster DNS/network access and narrowly scoped permissions.
  • Wait for Green, test the fixture endpoint through api-preview, then patch api-active. Adapt the example fixture URL/result to the actual business validation.
  • The JSON Patch test checks that the active selector is still R1; a conflicting promotion fails instead of silently overwriting it. It is a guard on one API object, not a cluster-wide traffic transaction.
Illustrative guarded promotion and rollback commandsbash
#!/usr/bin/env bash
# Illustrative commands, not an automatic release pipeline.
# Prerequisites: publisher/compatibility gates passed; kubectl, curl, jq;
# runner inside the cluster network; actual API implements this test fixture.
set -euo pipefail

# R1 (api-blue) remains ready while R2 (api-green) is validated.
kubectl -n domain-a rollout status deployment/api-green --timeout=300s
curl --fail --silent --show-error \
  http://api-preview.domain-a.svc.cluster.local/catalog/items/demo \
  | jq -e '.id == "demo"' >/dev/null

# Compare-and-change one Service selector; conflicting promotions fail closed.
kubectl -n domain-a patch service api-active --type=json --patch='[
  {"op":"test","path":"/spec/selector/release","value":"R1"},
  {"op":"replace","path":"/spec/selector/release","value":"R2"}
]'

# Observe representative post-promotion behavior separately. Do not delete Blue
# or its immutable files before the drain and rollback-retention gate passes.

# Rollback is a SEPARATE action, only after checking retained Blue and confirming
# data/configuration compatibility. Run these commands only when rollback is chosen:
# kubectl -n domain-a rollout status deployment/api-blue --timeout=300s
# kubectl -n domain-a patch service api-active --type=json --patch='[
#   {"op":"test","path":"/spec/selector/release","value":"R2"},
#   {"op":"replace","path":"/spec/selector/release","value":"R1"}
# ]'

Distinguish promotion failure from rollback

Failure point Action Remaining impact
Green rollout or preview test fails Stop before changing api-active Old release remains selected; preparation capacity was still consumed
Active target changes during another promotion JSON Patch test fails Reconcile the actual release owner; do not blindly retry
Post-promotion validation fails Validate retained Blue and its data contract, then reverse the guarded selector change Propagation and existing connections are still not instant
Blue files or compatible schema no longer exist Do not promise immediate rollback Restore the complete release or perform a forward recovery
  • The script deliberately does not scale down Blue or delete artifacts. Cleanup needs separate drain and retention evidence.
Compatibility before traffic promotion

Compatibility before traffic promotion

Kubernetes apps/v1 and core/v1 · illustrative Proposed settings, not inspected Current values

Check the complete release set

  • Match the running image digests, common/V1 and release-specific files against the tested R1/R2 manifest.
  • R2 can reuse common/V1 only after its integration/classpath/registration contract is validated. Published files alone do not establish that compatibility.
  • Check API, configuration and shared-data/schema behavior while both versions can exist.
  • Retain R1 files and a compatible data contract; switching the Service cannot undo an irreversible schema/data change.

Inspect the actual release manifests

  • The release-identity map contains the concrete R1/R2 JSON and read-only consumer mount example.
  • The publication map covers incomplete output, retries and the consumer-start gate. These are separate mechanisms from changing a Service selector.