Git, CI/CD & GitOpsLIX · RollbackBoundaries
Rollback across artifact boundaries — the five mechanisms and what each can undo
What you'll learn
- Identify the five distinct rollback mechanisms an infrastructure team operates
- Map each mechanism to the artifact boundary it crosses and the artifact boundary it cannot cross
- Recognise why a "rollback" that only restores one boundary leaves four others drifted
- Build the discipline of choosing the rollback mechanism based on the failure origin
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
A “rollback” sounds like a single button. It is not. An infrastructure change touches five distinct artifacts: the container image, the Kubernetes Deployment, the Terraform state, the configuration management run, and the database schema. Each artifact has its own source of truth, its own history, and its own rollback mechanism. A rollback that restores one of them while leaving four others drifted is a partial reversion, and the drift between them is itself a failure mode. The discipline of Part LIX is to know which mechanism recovers from which failure, and to recognise the failures no mechanism can recover from.
The five rollback mechanisms
Each mechanism crosses a different artifact boundary. The mechanisms are not interchangeable: the failure you are recovering from dictates which boundary to undo.
flowchart LR
A["Failure origin"] --> B{"Which artifact moved?"}
B -- "Image digest" --> C["Image rollback"]
B -- "Deployment spec" --> D["kubectl rollout undo"]
B -- "Cloud resource" --> E["git revert + terraform apply"]
B -- "Host config" --> F["Ansible next-run"]
B -- "Schema" --> G["Forward-fix migration"]
- Application rollback reverts the container image digest pinned by the Deployment. The registry is the source of truth; the rollback promotes the previous digest that the registry still holds.
- Kubernetes rollback reverts the Deployment spec via
ReplicaSet history. The controller remembers every
ReplicaSet it has created;
kubectl rollout undore-applies the previous one. - Terraform rollback reverts the cloud resources via
state and applied configuration. A
git revertof the bad commit plus a fresh reviewed plan and apply restores resources Terraform still owns; resources it no longer owns must be imported or recreated manually. - Configuration management rollback does not need an explicit command: the next run restores the desired state declared in the playbook, because Ansible is idempotent.
- Database rollback is the hardest. Schema changes are forward-only by discipline; the rollback is a forward fix (a compensating migration), not a backward restore.
What each mechanism can and cannot undo
The boundary a mechanism crosses defines its reach. Crossing the boundary is the rollback; failing to cross it is the limit.
- Image rollback cannot undo a database schema the new application wrote. It can roll the application back; the data is whatever the new application wrote.
- Kubernetes rollback cannot undo a Node that drained on a new taint, a CRD that was removed, or a StorageClass that no longer exists. The Deployment’s previous ReplicaSet can be re-applied, but the cluster resources it depends on may not be there.
- Terraform rollback cannot undo a resource deleted out-of-band. State records what Terraform owns; if the resource was deleted by hand, applying the reverted configuration will recreate it, but the recreation may collide with the lingering state of the deleted resource.
- Configuration management rollback cannot undo a package the previous run installed and the new run uninstalls, if the uninstallation breaks a dependency. The next run restores the declared state; it does not remember intermediate states.
- Database rollback cannot undo a column drop if a forward fix has not been written. Expand-and-contract makes every rollback possible by leaving the old column in place until the new column is proven.
Choosing the right mechanism
The right rollback mechanism is the one whose boundary the failure crossed. Diagnose first; the diagnosis dictates the action.
- 5xx spike after image change, no schema change.
Image rollback. Promote the previous digest; the
Deployment rolls back automatically on the next GitOps
sync, or explicitly via
kubectl rollout undo. - 5xx spike after manifest change, same image.
Kubernetes rollback. Revert the manifest commit; the
controller rolls back via
argocd app rollbackorkubectl rollout undo --to-revision=<n>. - Resource drift after Terraform change. Terraform
rollback. Revert the commit, review a fresh
terraform planagainst the current state, and apply;terraform state listconfirms what Terraform owns. - Host config drift after playbook change. Config-mgmt rollback. The next Ansible run restores the declared state; nothing else is needed.
- Data corruption after migration. Database forward-fix. Write a compensating migration; do not attempt to restore from backup unless the corruption is unrecoverable.
Production discipline
Five rules govern cross-boundary rollback:
- Diagnose the failure origin before choosing the mechanism. A 5xx spike can be image, manifest, IAM, or schema. Read the diff, then act.
- Roll back at the widest boundary that contains the failure. If the failure crosses boundaries, roll back at the boundary that contains them all.
- Verify the rollback at every boundary. A successful image rollback is not a successful schema rollback. Check each artifact.
- Treat a partial rollback as a failure. If you cannot roll back one of the affected boundaries, the rollback is incomplete; either extend it or escalate.
- Document the boundary choice in the post-mortem. A future team needs to know which boundary the failure crossed so they can recognise the same pattern faster.
Cross-course references
- Kubernetes for Production Sysadmins - Part XXII (Updates) covers Deployment rollback and the ReplicaSet history mechanism.
- Terraform for Production Sysadmins - Part XII (State) covers state-driven rollback and the import-after-delete recovery path.
- Ansible for Production Sysadmins - Part XXXIV (ConfigMgmt) covers idempotency and the next-run restoration property.
Quiz
Knowledge check · 4 questions
Q1. A team deploys a new application release. Within five minutes, the 5xx rate spikes to 30%. The team runs `kubectl rollout undo deployment/api` and the spike resolves. Two hours later, the on-call engineer notices that the database has a column the new version wrote but the previous version does not read. What boundary was missed in the rollback?
Q2. A rollback that addresses only one artifact boundary, while leaving four other boundaries drifted from the rolled-back state, is still a valid rollback because the symptom has been addressed.
Q3. Name the five artifact boundaries a serious production rollback must consider, and give one example of failure each boundary addresses.
Q4. Diagnose which boundary the failure crossed and identify the rollback mechanism that addresses it, including the boundaries that must be checked after the rollback completes.
A team deploys a new release that updates the application image, the Kubernetes Deployment, a Terraform-managed security group, and adds a column to the database. Within ten minutes, a 5xx spike is observed and the team sees in the diff that the new version requires a security group rule the old Terraform configuration did not declare. The team reverts the Deployment but does not touch Terraform, the image, or the database. Within an hour, the 5xx rate is lower but not zero, and the database has rows in the new column.
Passing score: 75%. Answers are checked in this browser.