- Creating a Prometheus rule for Argo CD application drift
- Where to add the rule (Prometheus Operator
PrometheusRule) - How to test by introducing drift in an Argo CD application
- Viewing the fired alert in Alertmanager and forwarding notifications (Slack example)
Define the Prometheus alert rule
Create aPrometheusRule group that triggers when Argo CD reports an OutOfSync application. The PromQL expression uses the argocd_app_info metric exposed by Argo CD.
What each field means
| Field | Purpose | Example / Notes |
|---|---|---|
name | Group name that organizes related alerts | ArgoCD Rules |
alert | Unique alert identifier shown in Alertmanager and dashboards | ArgoApplicationOutOfSync |
expr | PromQL expression that evaluates the condition | argocd_app_info{sync_status="OutOfSync"} == 1 |
for | Minimum duration the condition must hold before firing | 5m to avoid transient noise |
labels | Metadata for alert routing and severity | severity: warning (use critical for high priority) |
annotations | Human-readable descriptions inserted into notifications | summary using {{ $labels.name }} to reference the app name |
Where to add this rule
Add the group into an existingPrometheusRule resource managed by the Prometheus Operator (namespace often monitoring). Example commands to inspect and edit the PrometheusRule:
ArgoCD Rules group inside the spec.groups array. Example fragment showing the ArgoCD group placed at the top of spec.groups:
PrometheusRule; Prometheus will reload rules automatically, which can take a short moment.
Test the alert by causing drift
To test the rule, make an Argo CD application go OutOfSync. A simple approach is to modify the live cluster resource so it no longer matches the Git desired state. Open the Argo CD application UI and select an application to test. You can also directly edit a Deployment to introduce drift.
OutOfSync and the rule evaluates true for for: 5m, the alert will fire in Alertmanager. While waiting, Alertmanager may display other currently active alerts.

Viewing the fired alert
After thefor window elapses and the alert fires, Alertmanager will show the new alert. The alert details include labels such as job="argocd-metrics", namespace, the application name, repository URL, and the severity label.

Forwarding alerts (Slack example)
Once the alert appears in Alertmanager you can route it to external receivers (Slack, PagerDuty, email, etc.) by configuring Alertmanager receivers and routes.Ensure the
argocd_app_info metric is being scraped by Prometheus. Argo CD exposes metrics via the argocd-metrics endpoint; if Prometheus isn’t scraping argocd-metrics, the rule cannot evaluate true.
Notes and next steps
- After confirming the alert works, refine labels and routing in your Alertmanager configuration to match your on-call and escalation workflows.
- Use
severitylabels to differentiate notification channels (e.g.,warning-> pager muted,critical-> paged). - Integrate Grafana or other visualization tools to display Argo CD metrics and alert status.
- Prometheus Operator documentation
- Argo CD metrics & monitoring
- Alertmanager configuration guide
- Kubernetes Basics
- Grafana Slack notifications: https://grafana.com/docs/grafana/latest/alerting/notifications/notification-channels/slack/