Git, CI/CD & GitOpsLX · Forward Fix versus RollbackWhenRollback
When rollback is the right answer — config regressions, deployment bugs, image issues
What you'll learn
- Recognise the three categories of change where rollback is the safe response: config regressions, deployment bugs, image issues
- Verify the rollback surface before running the rollback command
- Apply the inspect-history, classify, rollback, verify pattern
- Distinguish rollback from forward-fix for incidents in the three categories
Prerequisites
Verified against Git 2.55.x teaching target; 2.40+ minimum · GitHub Actions continuous service; Aug 2026 documentation baseline · Argo CD v3.5.x teaching target; v3.0+ minimum · Flux v2.9.x · Sigstore Cosign v3.1.x · SLSA v1.2 · OCI Distribution Specification v1.1 · Git LFS v3.7.1 · Kubernetes (cross-course target) 1.36.x
Three categories of production change are rollback-safe by construction: config regressions, deployment bugs, and image issues. For these, the on-call engineer should reach for the rollback command; the forward-fix is the wrong reflex.
Config regressions
A config regression is a change to configuration that produces a behaviour the change did not intend. The regression is in the configuration; the data the system holds is unchanged. Examples: a ConfigMap value that broke feature-flag routing; a Terraform variable that shortened an idle timeout; an Ansible playbook that set a rejected sysctl; a Helm values file that set replicas to 0.
By the four properties: idempotent (yes), reversible (yes, via version control), data effects (no), dependency reach (narrow). The default response is rollback.
Deployment bugs
A deployment bug is a change to the workload manifest that produces a behaviour the change did not intend. The bug is in the pod template, the deployment strategy, or the resource limits. Examples: a readiness probe pointing at an unserved path; resource limits below the working set triggering OOM; an affinity rule excluding every node; a StatefulSet volume claim template change triggering an immutable-field error.
kubectl rollout history deployment/$NAME
kubectl rollout undo deployment/$NAME --to-revision=$N
kubectl rollout status deployment/$NAME
The pattern: inspect the history, identify the previous good revision, run the rollback, watch the rollout complete. The rollback restores the previous ReplicaSet; the cluster resources the Deployment depends on are unchanged by the bug.
Image issues
An image issue is a change to the container image that produces a behaviour the change did not intend. Examples: a broken migration runner baked into the image; a vulnerable base layer; a latest tag resolving to a development build; a missing CA certificate bundle. The image is part of the pod template; the rollback restores both.
kubectl rollout undo deployment/$NAME --to-revision=$N
argocd app rollback $APP_NAME
Caveat: an image tagged latest cannot be rolled back to a specific version. Pin by digest or by an immutable tag.
The operational pattern
The pattern for the three categories:
- Inspect the history.
kubectl rollout history,git log, the Terraform state diff. Identify the previous good revision. - Classify the change. Confirm the four properties match the category. If any property fails, fall back to Part LX-03.
- Run the rollback.
kubectl rollout undo,argocd app rollback. Watch the rollout complete. - Verify after. Confirm the application is healthy, the data tier is unchanged, and the surrounding cluster (ConfigMap, Secret, PVC, Service) is intact.
sequenceDiagram
participant Op as On-call engineer
participant K as kubectl / GitOps
participant C as Controller
participant W as Workload
Op->>K: rollout history deployment/$NAME
K-->>Op: revisions list
Op->>Op: classify change
Op->>K: rollout undo --to-revision=$N
K->>C: patch Deployment
C->>W: scale up rev $N
C-->>Op: rollout complete
Op->>Op: verify health
Production discipline
- Inspect the history before running the rollback. Confirm the previous good revision matches the expected good state.
- Classify against the four properties. Config, deployment, and image are rollback-safe; anything that writes data is not.
- Watch the rollout, do not fire and forget.
kubectl rollout statusis the guard. - Verify the cluster after the rollback. The workload rolled back; the surrounding cluster is the operator’s responsibility.
- Document the rollback in the incident record. The audit trail must show the revision, the rationale, and the verification.
Cross-course references
- This course, Part LIX-03 (Kubernetes rollback) and Part LIX-02 (Container rollback) cover the mechanisms.
- This course, Part LVIII-02 (Rolling update) covers the ReplicaSet model.
Quiz
Knowledge check · 4 questions
Q1. A team changes a ConfigMap value that controls a feature flag; the application returns 500 errors. The flag was added in this release; the previous release did not have it. What is the correct response?
Q2. An image tagged `latest` can be rolled back to the previous good version with the same operational simplicity as an image tagged by digest.
Q3. List the three categories of change for which rollback is the correct default response, and state the kubectl command that rolls back a Deployment to a specific revision.
Q4. Diagnose why a Deployment rollback restored the workload but the application remained unhealthy, and identify the cluster resource the operator must verify.
A stateless API is bumped from `api:v1.4.2` to `api:v1.5.0`. Ten minutes after rollout the application returns 500 'connection refused' to a sidecar. The on-call engineer runs `kubectl rollout undo deployment/api`; the rollback completes; pods become ready. The 500s persist. Pod logs show the sidecar cannot connect to the application's localhost port.
Passing score: 75%. Answers are checked in this browser.