Kubernetes and Cloud Native Associate (KCNA)Cloud Native ArchitectureMedium
A cloud-native application is deployed using a GitOps workflow. The operations team needs to roll back a recent deployment to a previous stable version after an unexpected critical bug was discovered in production. How would they typically initiate this rollback within a GitOps framework?
- ARevert the commit in the Git repository that represents the desired state of the application.
- BUse a CI/CD pipeline to redeploy the previous Docker image to the production cluster.
- CDirectly modify the Kubernetes resources using `kubectl` commands on the production cluster.
- DManually SSH into the production servers and replace the application binaries with older versions.
Show answer & explanationAnswer & explanation
Correct answer: A. Revert the commit in the Git repository that represents the desired state of the application.
In a GitOps workflow, Git is the single source of truth for the desired state. To roll back, the operations team would revert the problematic commit in the Git repository, which then triggers the GitOps operator to synchronize the cluster to this new, older desired state.
Why the other options are wrong
- B. While a CI/CD pipeline might be involved, the change itself originates from Git, not just a redeployment trigger.
- C. Direct `kubectl` modifications would diverge from the desired state in Git, which is anti-pattern in GitOps.
- D. Manual SSH changes are not part of automated, declarative GitOps practices.
GitOps Rollback
The process of reverting an application or infrastructure state to a previous version by manipulating the Git repository that defines the desired state.
- Git is the single source of truth.
- Rollbacks are performed by reverting Git commits.
- The GitOps operator detects the Git change and reconciles the cluster state.
- Ensures auditability and consistency.
Memory trick: GitOps: Code, Commit, Confirm, Cluster syncs.