Demonstrating configuring Prometheus and Grafana with kube-prometheus-stack to scrape Argo CD metrics via ServiceMonitors, visualize dashboards, and prepare Alertmanager alerts for application drift.
One major reason to monitor GitOps operators is to detect and alert when applications or clusters drift from their desired state. A common stack for this is Prometheus + Alertmanager for metrics and alerts, and Grafana for visualization. In this lesson we configure Prometheus and Grafana to collect Argo CD metrics and visualize them. The demo uses the kube-prometheus-stack Helm chart, which bundles Prometheus, Alertmanager, Grafana, node-exporter, and related components.
I deployed kube-prometheus-stack into the monitoring namespace. A quick pod check shows Alertmanager, Prometheus, Grafana and other components running (one node-exporter pod is CrashLoopBackOff in this environment — not relevant to Argo CD scraping):
Argo CD exposes Prometheus metrics for several components (Application Controller, API Server, Repo Server, Notifications Controller, etc.). The Prometheus Operator discovers and scrapes services via ServiceMonitor custom resources. The Argo CD docs include example ServiceMonitor manifests that you can adapt.
Important: the metadata.labels.release value on each ServiceMonitor must match the serviceMonitorSelector configured in your Prometheus custom resource (managed by the Prometheus Operator). If they don’t match, Prometheus will ignore the ServiceMonitor.
In this environment Prometheus will only pick up ServiceMonitor objects with the label release: kode-kloud-prometheus-stack. Adjust your ServiceMonitor manifests to match.
I created ServiceMonitor resources for Argo CD components and gave them the release label that matches the Prometheus selector (kode-kloud-prometheus-stack). These were applied to the argocd namespace.Summary of applied ServiceMonitors:
servicemonitor.monitoring.coreos.com/argocd-metrics createdservicemonitor.monitoring.coreos.com/argocd-server-metrics createdservicemonitor.monitoring.coreos.com/argocd-repo-server-metrics createdservicemonitor.monitoring.coreos.com/argocd-notifications-controller created
Prometheus (via the Prometheus Operator) will detect new ServiceMonitor objects and reload configuration automatically. It can take a minute or two for targets to appear as up.
Argo CD provides a community Grafana dashboard (JSON) that you can import to visualize key metrics: number of applications, health, sync status, repository counts, and component-level metrics. You can import via JSON upload or by URL.A minimal snippet of the dashboard metadata:
The dashboard uses Prometheus as the data source and filters metrics by namespace/cluster. After importing, panels show application counts, health/sync trends, repository statistics, and component metrics.
The Argo CD UI confirms the number of applications and repositories surfaced by Grafana:
Once Prometheus scrapes the Argo CD ServiceMonitor targets, Grafana panels querying Prometheus will populate (applications synced/healthy, server/repo statistics, etc.).
With metrics and dashboards in place, the next step is to author Prometheus alerting rules that detect conditions such as:
Application drift from desired state
Unexpected auto-syncs or sync failures
Repository errors or connection problems
Alertmanager can receive alerts from Prometheus and forward them (Slack, email, webhook). In the next lesson we’ll create Prometheus alerting rules and Alertmanager routes/receivers.
Callout: ServiceMonitor label matching
Always ensure the metadata.labels.release on your ServiceMonitor objects matches the serviceMonitorSelector.matchLabels.release value from your Prometheus CR. If they don’t match, Prometheus will not discover or scrape those ServiceMonitors.
That concludes this lesson — you should now have Prometheus scraping Argo CD metrics and Grafana visualizing them. Next, we’ll implement alerts that trigger when applications drift from their desired state.Links and references