Software Development Community Question

How to implement automated rollbacks in GitOps when a deployment fails health checks?

Posted on 2024-07-20 • In Software Development • By Ashley Thompson

One of our main concerns with GitOps is that if we commit a "bad" config to Git, the controller will faithfully sync it and break production. In a traditional CI/CD pipeline, we could just stop the script. How do we build "safety nets" into a pull-based model? Is there a way to make Argo CD or Flux automatically revert a commit if the Prometheus metrics show a spike in 500 errors after a sync?

3 Answers 11,593 Views

All answers to this question 3 Answers

Susan Martinez Answered on 2024-07-23
Answered

To achieve this, you need to look into Progressive Delivery tools like Argo Rollouts or Flagger. These act as "intelligent" controllers on top of your GitOps tool. Instead of a standard Deployment, you define a "Rollout" object. When you update the image tag in Git, the controller starts a Canary deployment. It monitors your metrics (via Prometheus or Datadog), and if it sees a latency spike, it automatically halts the rollout and reverts the traffic to the old version. The Git repo will still show the new version, so you’ll need a "Git-back" mechanism to sync the repo state with the cluster reality.

David Johnson Answered on 2024-07-25
Answered

Do you have enough traffic for Canary testing, or would a Blue-Green strategy be easier for your specific application architecture?

Richard Moore Commented on 2024-07-27
Commented

We have high traffic, but our app is stateful, which makes Blue-Green a bit difficult with database connections. We are leaning toward Canary. Does Flagger support Istio service mesh for the traffic shifting, and how hard is it to write the custom "Analysis" rules for the automated rollback logic?

Linda Davis Answered on 2024-07-29
Answered

You can also use Argo CD’s "Self-Heal" feature combined with a manual approval gate in your CI pipeline to prevent bad configs from reaching Git in the first place.

Ashley Thompson Commented on 2024-07-30
Commented

Manual gates are safe, but they slow us down. Automated analysis with Flagger is definitely the goal for true Continuous Deployment.

Write a Comment

Your email address will not be published. Required fields are marked (*)

Join the LearnersEra Community

Ask questions, share knowledge and learn from professionals across technology, project management and certification topics.

Change Country and Nearest City

Select your country and nearest city to see courses available in your region.