> ## Documentation Index
> Fetch the complete documentation index at: https://docs-xcor.paloaltonetworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Argo CD

> Application sync and health, reconciliation, repository, API server, notification and Go runtime metrics from Argo CD's components, scraped from their Prometheus endpoints.

The Argo CD integration requires CXDOT Collector 1.18.0 or greater.

[Argo CD](https://argoproj.github.io/cd/) is a declarative, GitOps continuous delivery
tool for Kubernetes. Use the Argo CD integration to collect Application sync and health,
reconciliation, Git repository, API Server, notification, and Go runtime metrics from
the Argo CD components running in your environment.

The Argo CD integration supports Argo CD 3.4 or greater.

## Supported telemetry types

The Argo CD integration supports these telemetry types:

| Type | Supported |
| - | - |
| Logs | No |
| Metrics | Yes |
| Traces | No |
| Events | No |

## Prerequisites

The Argo CD integration has the following prerequisites:

* Make the metrics port of each Argo CD component reachable from the CXDOT Collector.
  If a NetworkPolicy restricts ingress to the Argo CD pods, allow the CXDOT Collector
  to connect to these ports. By default, Argo CD serves metrics on the following ports:

  * Application Controller: `8082`
  * ApplicationSet Controller: `8080`
  * API Server: `8083`
  * Repository Server: `8084`
  * Notifications Controller: `9001`
  * Commit Server: `8087`

## Configure

The Argo CD integration is enabled by default. To choose the components that it collects
from, add a CXDOT integration annotation to the Argo CD pods or their metrics Services in
Kubernetes. Alternatively, list the metrics endpoints in your Helm values.

To configure the Argo CD integration, follow these steps:

1. To collect from Argo CD pods in Kubernetes, add a CXDOT integration annotation to the
   pod template of each component. The annotation key must end with the container name,
   and each endpoint names the component that serves it. For example, add the following
   annotation to your Application Controller StatefulSet:

   ```yaml theme={null}
   spec:
     template:
       metadata:
         annotations:
           integrations.cxdot.paloaltonetworks.com/application-controller: |
             schema_version: v1.17
             argocd:
               endpoints:
                 - endpoint: ${target.host}:${target.port.metrics}
                   component: application-controller
       spec:
         containers:
           - name: application-controller
             image: quay.io/argoproj/argocd
             ports:
               - name: metrics
                 containerPort: 8082
   ```

   The Collector replaces `${target.host}` with the pod IP address and
   `${target.port.metrics}` with the container port named `metrics`. Metrics from each
   annotated pod include that pod's Kubernetes metadata.

   With the Argo CD Helm chart, add the annotation under the `podAnnotations` value of
   each component: `controller`, `applicationSet`, `server`, `repoServer`,
   `notifications`, and `commitServer`. The chart names each component's container
   after its `component` value, such as `repo-server`, and its metrics port `metrics`,
   so the annotation for each component differs from the example only in the container
   name and the `component` value.

2. Optional: If your Argo CD containers don't name their metrics ports, as most
   containers in the published installation manifests don't, configure the metrics
   Service of each component with a CXDOT integration annotation instead. The
   `integrations.cxdot.paloaltonetworks.com/endpoints` key makes each ready pod behind
   the Service a separate target. For example, add the following annotation to the
   `argocd-metrics` Service, which serves the Application Controller's metrics:

   ```yaml theme={null}
   metadata:
     annotations:
       integrations.cxdot.paloaltonetworks.com/endpoints: |
         schema_version: v1.17
         argocd:
           endpoints:
             - endpoint: ${target.host}:${target.port.metrics}
               component: application-controller
   spec:
     ports:
       - name: metrics
         port: 8082
         targetPort: 8082
   ```

   The Collector replaces `${target.host}` with the IP address of each pod and
   `${target.port.metrics}` with the pod port that the Service port named `metrics`
   forwards to. In the published manifests, the metrics Services of the other components
   are `argocd-applicationset-controller`, `argocd-server-metrics`, `argocd-repo-server`,
   `argocd-notifications-controller-metrics`, and `argocd-commit-server`, and each one
   names its metrics port `metrics`.

3. Optional: To collect from Argo CD components in another Kubernetes cluster or at
   addresses that you choose, configure static targets. List the metrics endpoint of
   each component in `endpoints`, with the component that serves it. For example, add
   the following to the Helm values file for your CXDOT Collector:

   ```yaml theme={null}
   collection:
     cxdot:
       integrations:
         argocd:
           endpoints:
             - endpoint: argocd-controller.example.com:8082
               component: application-controller
             - endpoint: argocd-server.example.com:8083
               component: server
             - endpoint: http://argocd-repo-server.example.com:8084/metrics
               component: repo-server
   ```

   When you list endpoints, the integration collects from exactly those endpoints
   instead of from annotated pods and Services. In Kubernetes, the elected cluster
   Collector collects from each endpoint that you list, one time rather than once per
   node. For more information, see
   [architecture](https://docs-xcor.paloaltonetworks.com/ingest/xcor/collector/install/kubernetes/architecture.md).

   Metrics from listed endpoints don't carry Kubernetes metadata from the Argo CD
   pods. Use the `argocd.component` and `url.full` attributes to identify each
   endpoint.

4. Optional: If your Argo CD metrics endpoints use HTTPS or require a bearer token,
   configure the integration to match. Set `bearer_token_file` to the path of a file
   that holds the token, and use `tls` to verify the server certificate. These settings
   require `schema_version: v1.18` or later, in your Helm values or in the CXDOT
   integration annotation. For example,
   add the following to the Helm values file for your CXDOT Collector:

   ```yaml theme={null}
   collection:
     cxdot:
       integrations:
         argocd:
           bearer_token_file: /etc/cxdot/argocd/token
           tls:
             ca_file: /etc/cxdot/argocd/ca.crt
           endpoints:
             - endpoint: https://argocd-server.example.com:8083/metrics
               component: server
   ```

   The Collector sends the token in the `Authorization` header of every request to the
   Argo CD components and rereads the file when it changes, so you can rotate the token
   without restarting the Collector. The `tls` settings apply to HTTPS endpoints only.
   Set `tls.ca_file` to a single PEM file that holds the certificate authority (CA)
   certificates. The Collector doesn't read a directory of certificates. Mount the token
   and the CA certificate file into the Collector pods that collect from the endpoints,
   for example from a Kubernetes Secret, with the `extraVolumes` and `extraVolumeMounts`
   values of the `clusterCollector` or `nodeCollector`. The Collector doesn't support
   basic authentication with a username and password for this integration.

   For annotated pods and Services, set these settings in the CXDOT integration
   annotation instead. The Collector rejects an annotation that sets `tls.ca_file`,
   `bearer_token_file`, or any other setting that names a file, unless the file is under
   `collection.cxdot.integrations.discovery.kubernetes.annotation_restrictions.allowed_collector_file_paths`
   in your Helm values, which allows no paths by default. The node Collector collects
   from annotated pods and the cluster Collector from annotated Services, so mount the
   file into the Collector for each kind of annotation that names it. For example, the
   following Helm values mount a Kubernetes Secret into both Collectors and allow its
   path:

   ```yaml theme={null}
   nodeCollector:
     extraVolumes:
       - name: argocd-metrics-auth
         secret:
           secretName: argocd-metrics-auth
     extraVolumeMounts:
       - name: argocd-metrics-auth
         mountPath: /etc/cxdot/argocd
         readOnly: true
   clusterCollector:
     extraVolumes:
       - name: argocd-metrics-auth
         secret:
           secretName: argocd-metrics-auth
     extraVolumeMounts:
       - name: argocd-metrics-auth
         mountPath: /etc/cxdot/argocd
         readOnly: true
   collection:
     cxdot:
       integrations:
         discovery:
           kubernetes:
             annotation_restrictions:
               allowed_collector_file_paths:
                 - /etc/cxdot/argocd
               custom_pod_host: deny
               custom_service_host: deny
   ```

   Then set `bearer_token_file: /etc/cxdot/argocd/token` in the `argocd` block of the
   annotation, where `token` is the key that holds the token in the Kubernetes Secret,
   and set the annotation's `schema_version` to `v1.18` or later.
   The Secret must be in the namespace of your CXDOT Collector. After you allow a path,
   an annotation on any pod or Service in your cluster can name the file, and the
   Collector sends the token to that annotation's target. The `custom_pod_host: deny`
   and `custom_service_host: deny` settings limit each annotation's target to the
   annotated pod's or Service's own addresses, so the token reaches only annotated
   workloads. Allow only paths that hold secrets that you
   intend annotated workloads to use.

5. Optional: To collect from both annotated pods and listed endpoints, list the
   endpoints in a second integration instance. For example, add the following to the
   Helm values file for your CXDOT Collector:

   ```yaml theme={null}
   collection:
     cxdot:
       integrations:
         argocd: {}
         argocd/remote:
           endpoints:
             - endpoint: argocd-controller.example.com:8082
               component: application-controller
   ```

   The `argocd/remote` key defines a named instance for the listed endpoints. The bare
   `argocd` key lists no endpoints, so the integration continues to collect from
   annotated pods and Services.

6. Optional: If the OpenMetrics integration also scrapes your Argo CD pods or Services,
   disable OpenMetrics on that workload to avoid duplicate metrics. For example, set
   `openmetrics: {enabled: false}` in a CXDOT integration annotation on the pod or
   Service. For more information, see
   [autodiscovery](https://docs-xcor.paloaltonetworks.com/ingest/xcor/collector/discover/kubernetes.md).

### Validate

To validate the Argo CD integration, follow these steps:

1. In the [Live Telemetry Analyzer](https://docs-xcor.paloaltonetworks.com/investigate/analyze/telemetry-analyzer.md),
   filter for `__name__=cxdot.integration.target.health` and
   `cxdot.integration.name=argocd`. Confirm that each component reports `1` for
   `cxdot.integration.target.health`, identified by its `argocd.component` and
   `url.full` attributes.

2. In [Metrics Explorer](https://docs-xcor.paloaltonetworks.com/investigate/querying/metrics/explorer.md),
   run the following query:

   ```text theme={null}
   sum by ("argocd.app.sync.status", "argocd.app.health.status") ({"argocd.app.info"})
   ```

   Confirm that the query returns a time series for each combination of sync status
   and health status that your Applications report.

### Troubleshooting

* A component reports `0` for `cxdot.integration.target.health`: Confirm that the
  component meets the requirements in the Prerequisites section and that its endpoint
  uses the component's metrics port, such as `8083` for the API Server rather than `8080`,
  the port that serves its API.
* `argocd.app.labels`, `argocd.app.condition`, or `argocd.appset.labels` doesn't appear:
  Argo CD reports these metrics only for the labels and conditions that you name. Set
  `--metrics-application-labels` and `--metrics-application-conditions` on the
  Application Controller, and `--metrics-applicationset-labels` on the ApplicationSet
  Controller. For more information, see
  [Metrics](https://argo-cd.readthedocs.io/en/stable/operator-manual/metrics/) in the
  Argo CD documentation.
* GitHub API metrics don't appear: The ApplicationSet Controller reports
  `argocd.github_api.*` metrics only for generators that call the GitHub API, and only
  after you set `applicationsetcontroller.enable.github.api.metrics: "true"` in the
  `argocd-cmd-params-cm` ConfigMap.
* Commit Server metrics don't appear: Argo CD runs the Commit Server only when the
  [source hydrator](https://argo-cd.readthedocs.io/en/stable/user-guide/source-hydrator/)
  is enabled.

## Configuration reference

Configure one Argo CD integration instance with the following settings. In Helm values, place
these settings under `collection.cxdot.integrations.argocd`. In a Collector configuration file,
place them under `cxdot.integrations.argocd`.

### Optional settings

* **`enabled`**
  Type: `boolean`. Optional. Default: `true`.
  Whether to enable this Argo CD integration instance. If true, the Collector collects metrics
  from the Argo CD components that this instance is configured for. If false, the Collector
  doesn't run this integration instance.

* **`endpoints`**
  Type: `array of object`. Optional. Default: `[]`.
  Argo CD components to monitor, by the address of each component's Prometheus metrics endpoint.
  Each entry is one target, so list an address that reaches one component pod. An address that
  balances requests across replicas, such as a Kubernetes Service with several pods, reaches a
  different replica on each collection.

* **`endpoints[].endpoint`**
  Type: `string`. Required.
  Address of the component's metrics endpoint. Specify `host:port` to request the `/metrics`
  path over HTTP, or a full HTTP or HTTPS URL. The Collector requests a URL with a path as
  given, and requests `/metrics` for a URL without a path. By default, Argo CD serves metrics on
  port `8082` for the Application Controller, `8080` for the ApplicationSet Controller, `8083`
  for the API Server, `8084` for the Repository Server, `9001` for the Notifications Controller,
  and `8087` for the Commit Server.

* **`endpoints[].component`**
  Type: `string`. Required.
  The Argo CD component that serves the endpoint. The Collector reports it as the
  `argocd.component` attribute on every metric from the endpoint. The values are the component
  names that Argo CD's manifests use in the `app.kubernetes.io/component` label, where `server`
  is the API Server. Allowed values: `application-controller`, `applicationset-controller`,
  `server`, `repo-server`, `notifications-controller`, `commit-server`.

* **`collection_interval`**
  Type: `duration`. Optional. Default: `15s`.
  How often the integration collects metrics from each Argo CD component.

* **`timeout`**
  Type: `duration`. Optional. Default: `10s`.
  Maximum time the Collector waits for one collection from a component. The value must be
  greater than zero. A value longer than `collection_interval` is lowered to
  `collection_interval`.

* **`max_samples`**
  Type: `integer`. Optional. Default: `0`. Minimum: `0`.
  Maximum number of samples accepted from one metric collection. A value of `0`, the default,
  means no limit. A collection that exceeds the limit fails and reports the target as unhealthy
  instead of returning an incomplete set of samples. The Application Controller reports several
  time series for each Application, so its sample count grows with the number of Applications.

* **`follow_redirects`**
  Type: `boolean`. Optional. Default: `true`.
  Whether to follow HTTP redirects. If true, the Collector follows redirects. If false, a
  redirect causes the metric collection to fail.

* **`bearer_token_file`**
  Type: `string`. Optional. Default: empty string.
  Path to a file that holds a bearer token. The Collector sends the token in the `Authorization`
  header of every request to the Argo CD components and rereads the file when it changes. If the
  metrics endpoints don't require a token, omit this setting.

* **`tls`**
  Type: `object`. Optional.
  Transport layer security (TLS) settings for HTTPS endpoints. The Collector verifies
  certificates unless `insecure_skip_verify` is `true`. These settings don't apply to HTTP
  endpoints.

* **`tls.ca_file`**
  Type: `string`. Optional.
  Path to a single PEM file that holds the certificate authority (CA) certificates used to
  verify the Argo CD component's server certificate. A directory of certificates isn't
  supported. If set, the Collector trusts only the certificate authorities in this file instead
  of the system certificate authority pool.

* **`tls.insecure_skip_verify`**
  Type: `boolean`. Optional.
  Whether to skip verification of the Argo CD component's server certificate. If true, the
  connection is encrypted but isn't authenticated and is vulnerable to man-in-the-middle
  attacks. If false, the Collector verifies the server certificate.

* **`tls.server_name`**
  Type: `string`. Optional.
  Server name to verify in the Argo CD component's server certificate instead of the endpoint
  hostname. The Collector also sends this name as the TLS server name indication. Use this
  setting when the certificate name differs from the endpoint hostname.


## Related topics

- [CXDOT Collector integrations](https://docs-xcor.paloaltonetworks.com/ingest/xcor/integrations/collector.md)
- [Case study: responding to incidents](https://docs-xcor.paloaltonetworks.com/overview/case-studies/respond-to-incidents.md)
- [Service accounts](https://docs-xcor.paloaltonetworks.com/administer/accounts-teams/service-accounts.md)
- [Case study: protecting a telemetry data budget](https://docs-xcor.paloaltonetworks.com/overview/case-studies/manage-budgets.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.