Contents
Argo CD: Rollback as an Emergency Brake
In the previous part we prepared infrastructure with Terraform and Helm templates for microservices. Now it is time to connect everything and consider the most important question: what happens when something goes wrong?
Argo CD Application: bringing it together
An Argo CD Application is YAML that says: “Take these Helm templates, apply these values and deploy them to this cluster.”
# argocd/applications/payment-service.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: payment-service
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/your-org/k8s-manifests.git
path: helm/microservice
targetRevision: main
helm:
valueFiles:
- ../../environments/production/payment-service.yaml
destination:
server: https://kubernetes.default.svc
namespace: production
syncPolicy:
automated:
prune: true # Deletes resources removed from Git
selfHeal: true # Corrects manual changes in the cluster
syncOptions:
- CreateNamespace=true
retry:
limit: 3
backoff:
duration: 5s
factor: 2
maxDuration: 3mSync policies: automatic protection
selfHeal: true is key: if someone changes the cluster manually with kubectl edit, Argo CD restores the state defined in Git, avoiding configuration drift.
prune: true means that if a resource is deleted from Git, Argo CD also deletes it from the cluster: no zombie deployments.
retry means that if sync fails, for example because of a temporary network issue, Argo CD retries with exponential backoff.
Rollback: the emergency brake
Friday, 4:30 p.m. The payment service is broken. Now what?
Option 1: Git revert (recommended)
# 1. Inspect history
git log --oneline -5
# a1b2c3d feat: payment-service 2.4.1
# d4e5f6g feat: user-service 1.8.0
# g7h8i9j fix: order-service healthcheck
# ...
# 2. Revert the last commit
git revert HEAD --no-edit
# 3. Push
git push origin main
# 4. Argo CD synchronizes automatically
# payment-service returns to version 2.4.0
# Entire process: ~60 secondsWhy this is best:
- ✅ A full audit trail in Git: who reverted, when and why
- ✅ Argo CD synchronizes automatically
- ✅ No manual cluster work
- ✅ The revert is also a commit and can itself be reverted
Option 2: Argo CD CLI rollback
# Inspect deployment history
argocd app history payment-service
# ID DATE REVISION
# 5 2026-02-14 16:30:00 a1b2c3d (feat: payment-service 2.4.1)
# 4 2026-02-10 09:00:00 x9y8z7w (feat: payment-service 2.4.0)
# 3 2026-01-28 14:15:00 m3n4o5p (fix: payment-service 2.3.2)
# Roll back to revision 4
argocd app rollback payment-service 4Option 3: Pin a specific Git SHA
# To select a specific version
argocd app set payment-service --revision x9y8z7w
argocd app sync payment-serviceComparing rollback methods
| Method | Speed | Audit trail | Complexity |
|---|---|---|---|
| Git revert | ~60s | Full (in Git) | Low |
| Argo CD CLI rollback | ~30s | Partial | Medium |
| Pin to SHA | ~30s | Partial | Medium |
| kubectl rollout undo | ~10s | None | Dangerous |
The full workflow: from commit to rollback
HAPPY PATH
Developer pushes code → CI builds image → CI updates Helm image tag
→ Argo CD detects change → Helm renders manifests → Rolling update
→ Health checks pass ✅ → Deployment SYNCED ✅
ROLLBACK PATH
Monitoring/alerts show a problem → git revert → push to Git
→ Argo CD detects change → previous version deployed
→ Service works ✅ → Postmortem on Monday 📋App of Apps: when you have 20+ microservices
For larger projects Argo CD supports the App of Apps pattern: one Argo CD application manages the others.
# argocd/app-of-apps.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: platform
namespace: argocd
spec:
source:
repoURL: https://github.com/your-org/k8s-manifests.git
path: argocd/applications # Directory containing all Application YAML files
targetRevision: main
destination:
server: https://kubernetes.default.svc
namespace: argocd
syncPolicy:
automated:
prune: true
selfHeal: trueargocd/applications/
├── payment-service.yaml
├── order-service.yaml
├── user-service.yaml
├── notification-service.yaml
├── inventory-service.yaml
└── gateway.yamlAdding a microservice means adding one YAML file. Argo CD takes care of the rest.
Why App of Apps?
Without this pattern, you must create an Argo CD Application manually for every microservice:
# ❌ Manual — for every new service
kubectl apply -f argocd/applications/new-service.yamlWith App of Apps, commit a new YAML file to argocd/applications/ and Argo CD deploys it automatically. Meta-GitOps: even Argo CD applications themselves are managed through Git.
Conclusion
Microservice deployment does not have to be stressful. Combining Terraform for infrastructure, Helm for templates and Argo CD for GitOps delivery gives you a fully auditable, automated and, above all, reversible deployment pipeline.
Rollback is not panic. Rollback is git revert. And that is how it should be.