Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 2. Monitoring
2.1. Monitoring with GitOps dashboards Copier lienLien copié sur presse-papiers!
Monitoring GitOps instances helps you track application deployments, troubleshoot synchronization issues, and optimize resource usage. The Red Hat OpenShift GitOps monitoring dashboards provide a graphical view of instance health, application status, component performance, and rollout metrics across your cluster.
There are four GitOps dashboards available:
- GitOps Overview: See an overview of all GitOps instances installed on the cluster, including the number of applications, health and sync status, application and sync activity.
- GitOps Components: View detailed resource metrics, such as CPU and memory usage, for the application-controller, repo-server, server, and other GitOps components.
- GitOps gRPC Services: View metrics related to gRPC service activity between the various components in Red Hat OpenShift GitOps.
- GitOps Rollouts: View metrics related to the total active Rollouts resources, the number of available, desired, and unavailable replicas, and statistics on the performance of the Rollouts controller.
2.1.1. Accessing GitOps monitoring dashboards Copier lienLien copié sur presse-papiers!
The Red Hat OpenShift GitOps Operator automatically deploys monitoring dashboards when you install it. Access these dashboards from the Administrator perspective of the OpenShift Container Platform web console to monitor instance health, application synchronization status, and component performance.
Disabling or changing the content of the dashboards is not supported.
Prerequisites
- You have access to the OpenShift Container Platform web console.
-
The Red Hat OpenShift GitOps Operator is installed in the default namespace,
openshift-gitops-operator. -
Cluster monitoring is enabled on the
openshift-gitops-operatornamespace. -
A GitOps instance is installed and running in a namespace, such as
openshift-gitops.
Procedure
-
In the Administrator perspective of the web console, go to Observe
Dashboards. - From the Dashboard drop-down list, select the desired GitOps dashboard: GitOps (Overview), GitOps / Components, GitOps / gRPC Services or GitOps / Rollouts.
- Optional: Choose a specific namespace, cluster, and interval from the Namespace, Cluster, and Interval drop-down lists.
- Review the metrics displayed in the dashboard to monitor your GitOps instance health and performance.
2.2. Monitoring Argo CD instances Copier lienLien copié sur presse-papiers!
Monitoring Argo CD instances helps you track application health, troubleshoot synchronization issues, and measure deployment performance. The Red Hat OpenShift GitOps Operator automatically connects Argo CD instances to the cluster monitoring stack to collect metrics and generate alerts for out-of-sync applications.
2.2.1. Prerequisites Copier lienLien copié sur presse-papiers!
-
You have access to the cluster with
cluster-adminprivileges. - You have access to the OpenShift Container Platform web console.
- You have installed the Red Hat OpenShift GitOps Operator in your cluster.
-
An GitOps instance is installed and running in a namespace, such as
openshift-gitops.
2.2.2. Monitoring Argo CD health using Prometheus metrics Copier lienLien copié sur presse-papiers!
Monitor the health status of your Argo CD applications by querying Prometheus metrics. This helps you identify degraded applications, track sync status, and troubleshoot deployment issues.
Prerequisites
- You have access to the OpenShift Container Platform web console.
- At least one application is deployed using GitOps.
- Monitoring is enabled for the namespace where your Argo CD instance is installed.
Procedure
-
In the Developer perspective of the web console, select the namespace where your application is deployed, and navigate to Observe
Metrics. - From the Select query drop-down list, select Custom query.
To check the health status of your application, enter the Prometheus Query Language (PromQL) query similar to the following example in the Expression field:
Example:
sum(argocd_app_info{dest_namespace=~"<your_defined_namespace>",health_status!=""}) by (health_status)
+
where:
<your_defined_namespace>-
Specifies the variable with the actual name of your defined namespace, for example
openshift-gitops.
Review the query results to check the health status of your applications. The results show the number of applications grouped by health status values such as Healthy, Progressing, Degraded, Suspended, or Missing.
2.2.3. Disabling automatic scraping of metrics for Argo CD instances Copier lienLien copié sur presse-papiers!
Disabling automatic metric scraping for Argo CD instances helps prevent excessive storage usage in clusters with multiple instances. By default, the Red Hat OpenShift GitOps Operator scrapes metrics for all Argo CD instances, creating monitoring resources and labels in each namespace.
As a result, the Operator creates the following resources and labels in the namespace where the Argo CD instance is installed:
-
gitops-operator-argocd-alertsprometheus rule -
<argocd_namespace>-readrole -
<argocd_name>,<argocd_name>-repo-server, and<argocd_name>-serverservice monitors -
<argocd_namespace>-prometheus-k8s-read-bindingrole binding -
openshift.io/cluster-monitoring=truelabel
If you have multiple Argo CD instances, scraping metrics for each instance can increase storage usage. To reduce storage consumption and gain more control over monitoring, disable metric scraping for individual instances by using the web console’s YAML view to configure the Argo CD custom resource (CR).
As a cluster administrator, by disabling metric scraping for individual instances, you can give your users better control, flexibility, and stability to manage their defined namespaces.
Procedure
- Log in to the OpenShift Container Platform web console.
-
In the Administrator perspective of the web console, click Operators
Installed Operators. - From the Project list, select the project where the user-defined Argo CD instance is installed.
- Select Red Hat OpenShift GitOps from the installed Operators list and go to the Argo CD tab.
- Click your user-defined Argo CD instance.
Configure the
ArgoCDCR of your user-defined Argo CD instance to disable the automatic scraping of metrics:-
Click the YAML tab and edit the YAML file of the
ArgoCDCR. In the
ArgoCDCR, set thespec.monitoring.disableMetricsfield value totrue:Example
ArgoCDCR:apiVersion: argoproj.io/v1beta1 kind: ArgoCD metadata: name: example namespace: spring-petclinic spec: monitoring: disableMetrics: truewhere:
metadata.name- Specifies the name of the user-defined Argo CD instance.
metadata.namespace- Specifies the namespace where you want to run the user-defined Argo CD instance.
TipAlternatively, use the
ocCLI to disable automatic metric scraping:$ oc patch argocd example -n spring-petclinic --type='json' -p='[{"op": "replace", "path": "/spec/monitoring/disableMetrics", "value": true}]'Example output:
argocd.argoproj.io/example patched
-
Click the YAML tab and edit the YAML file of the
Verify that the Operator adds the
openshift.io/cluster-monitoring=falselabel to your defined namespace:Go to Administration
Namespaces. The Namespaces page displays the created namespaces.
-
Click your defined namespace, go to the YAML tab, and verify that under the
metadata.labelssection, theopenshift.io/cluster-monitoring=falselabel is added by the Operator.
Verify that the Operator deletes the following resources from your defined namespace:
-
Go to Home
Search. From the Resources list, select PrometheusRule, Role, RoleBinding, and ServiceMonitors.
The Search page displays the selected resources.
-
In the Search page, verify that under the PrometheusRule section, the
gitops-operator-argocd-alertsprometheus rule is removed. - Under the Roles section, from the Filter list, select Namespace Roles.
-
Verify that the
<argocd_namespace>-readrole is removed. - Under the RoleBindings section, from the Filter list, select Namespace RoleBindings.
-
Verify that the
<argocd_namespace>-prometheus-k8s-read-bindingrole binding is removed. -
Verify that under the ServiceMonitors section, the
<argocd_name>,<argocd_name>-repo-server, and<argocd_name>-serverservice monitors are removed.
-
Go to Home
You can enable the metrics for your instance by modifying the spec.monitoring.disableMetrics field value to false. The Operator then creates the required role, role bindings, and service monitors and adds the openshift.io/cluster-monitoring=true label to your defined namespace.
2.3. Monitoring the GitOps Operator performance Copier lienLien copié sur presse-papiers!
Monitor Red Hat OpenShift GitOps Operator performance to identify resource bottlenecks, track reconciliation times, and optimize cluster performance. The Operator exposes performance metrics that the OpenShift monitoring stack collects and displays in the OpenShift Container Platform web console. You can track the following metrics:
| Metric name | Type | Description |
|---|---|---|
|
| Gauge | The total number of active Argo CD instances currently managed by the Operator across the cluster. |
|
| Gauge | The number of active Argo CD instances in a given phase, such as Pending or Available. |
|
| Counter | The total number of reconciliations that have occurred for an Argo CD instance in a given namespace. |
|
| Counter |
The number of reconciliation cycles completed under given time durations for an instance. For example, |
|
| Counter | The total number of reconciliation cycles observed for a given instance. |
|
| Counter | The total amount of time taken for the observed reconciliations for a given instance. |
Gauge is a value that can go up or down. Counter is a value that can only go up.
2.3.1. Accessing the GitOps Operator metrics Copier lienLien copié sur presse-papiers!
The OpenShift Container Platform web console provides access to GitOps Operator metrics through the Administrator perspective. Use these metrics to track reconciliation performance, monitor active instances, and identify potential bottlenecks.
Prerequisites
- You have access to the OpenShift Container Platform web console.
-
The Red Hat OpenShift GitOps Operator is installed in the default
openshift-gitops-operatornamespace. -
Cluster monitoring is enabled for the
openshift-gitops-operatornamespace.
Procedure
-
In the Administrator perspective of the web console, go to Observe
Metrics. In the Expression field, enter the name of the metric you want to query. See the metrics table for available options.
-
active_argocd_instances_total -
active_argocd_instances_by_phase -
active_argocd_instance_reconciliation_count -
controller_runtime_reconcile_time_seconds_per_instance_bucket -
controller_runtime_reconcile_time_seconds_per_instance_count -
controller_runtime_reconcile_time_seconds_per_instance_sum
-
Optional: Filter the metric by its properties. For example, filter the
active_argocd_instances_by_phasemetric by theAvailablephase:Example:
active_argocd_instances_by_phase{phase="Available"}- Optional: Click Add query to enter multiple queries.
- Click Run queries to enable and observe the GitOps Operator metrics.
- Review the metrics visualization to monitor Operator performance.
2.4. Monitoring health information for application resources and deployments Copier lienLien copié sur presse-papiers!
The Red Hat OpenShift GitOps Environments page in the Developer perspective of the OpenShift Container Platform web console shows a list of the successful deployments of the application environments, along with links to the revision for each deployment.
The Application environments page in the Developer perspective of the OpenShift Container Platform web console displays the health status of application resources, such as routes, synchronization status, deployment configurations, and deployment history.
2.4.1. Settings for environment labels and annotations Copier lienLien copié sur presse-papiers!
Configure specific labels and annotations in your application and namespace manifests to enable environment monitoring in the OpenShift Container Platform web console. These settings allow the GitOps Operator to identify and track your application environments.
Environment labels
The environment application manifest must include the labels.openshift.gitops/environment and destination.namespace fields. The value of the openshift.gitops/environment label must match both the destination.namespace value and the application manifest name.
Example environment application manifest specification:
spec:
labels:
openshift.gitops/environment: <environment_name>
destination:
namespace: <environment_name>
# ...
Example of an environment application manifest:
apiVersion: argoproj.io/v1beta1
kind: Application
metadata:
name: dev-env
namespace: openshift-gitops
spec:
labels:
openshift.gitops/environment: dev-env
destination:
namespace: dev-env
# ...
where:
metadata.name-
Specifies the name of the environment application manifest. This value must match the
openshift.gitops/environmentlabel value and thedestination.namespacevalue.
Environment annotations
The environment namespace manifest must include the annotations.app.openshift.io/vcs-uri and annotations.app.openshift.io/vcs-ref fields to specify the version control source repository of the application. The namespace name must match the environment name that the application manifest defines.
Example environment namespace manifest specification:
apiVersion: v1
kind: Namespace
metadata:
annotations:
app.openshift.io/vcs-uri: <application_source_url>
app.openshift.io/vcs-ref: <branch_reference>
name: <environment_name>
# ...
where:
- metadata.name
- Specifies the name of the environment namespace. This value must match the environment name defined in the application manifest.
Example of an environment namespace manifest:
apiVersion: v1
kind: Namespace
metadata:
annotations:
app.openshift.io/vcs-uri: https://example.com/<your_domain>/<your_gitops.git>
app.openshift.io/vcs-ref: main
labels:
argocd.argoproj.io/managed-by: openshift-gitops
name: dev-env
# ...
2.4.2. Checking health information Copier lienLien copié sur presse-papiers!
Check the health status and deployment history of your GitOps-managed applications using the GitOps environments monitoring interface in the OpenShift Container Platform web console.
Prerequisites
- You have installed the Red Hat OpenShift GitOps Operator from OperatorHub.
- Your applications are managed and synchronized by Argo CD.
Procedure
- In the OpenShift Container Platform web console, navigate to the Developer perspective and click Environments. The Environments page shows the list of applications along with their Environment status.
- Hover over the icons under the Environment status column to see the synchronization status of all the environments.
- Click the application name from the list to view the details of a specific application.
In the Application environments page, view the Resources section under the Overview tab to check the resource health status:
- A broken heart icon indicates that resource issues have degraded the application’s performance.
- A yellow yield sign icon indicates that resource issues have delayed the health status data.
-
Optional: In the Application environments page, click the Deployment History tab to view the deployment history. The page displays details such as
Last deployment,Description (commit message),Environment,Author, andRevision.
2.5. Monitoring Argo CD custom resource workloads Copier lienLien copié sur presse-papiers!
With Red Hat OpenShift GitOps, you can monitor the availability of Argo CD custom resource workloads for specific Argo CD instances. When workload pods for components such as the application controller, repository server, or API server fail to start, or when the number of ready replicas does not match the desired replica count, the GitOps Operator triggers alerts. You can enable or disable workload monitoring for individual Argo CD instances.
2.5.1. Prerequisites Copier lienLien copié sur presse-papiers!
-
You are logged in to the cluster as a user with the
cluster-adminrole. - Red Hat OpenShift GitOps is installed in your cluster.
-
The monitoring stack is configured in your cluster in the
openshift-monitoringproject. In addition, the Argo CD instance is in a namespace that you can monitor through Prometheus. -
The
kube-state-metricsservice is running on your cluster. Optional: If you are enabling monitoring for an Argo CD instance already present in a user-defined project, ensure that the monitoring is enabled for user-defined projects in your cluster.
NoteIf you want to enable monitoring for an Argo CD instance in a namespace that is not watched by the default
openshift-monitoringstack, for example, any namespace that does not start withopenshift-*, then you must enable user workload monitoring in your cluster. This action enables the monitoring stack to pick up the created PrometheusRule.
2.5.2. Enabling monitoring for Argo CD custom resource workloads Copier lienLien copié sur presse-papiers!
By default, the monitoring configuration for Argo CD custom resource workloads is set to false.
Enable workload monitoring for specific Argo CD instances to receive alerts when component replica counts drift from the desired state. When enabled, the GitOps Operator creates a PrometheusRule object that defines alert rules for all workloads managed by the Argo CD instance. The Operator does not overwrite manual changes to the PrometheusRule object.
Procedure
Set the
.spec.monitoring.enabledfield value totrueon a given Argo CD instance:Example Argo CD custom resource:
apiVersion: argoproj.io/v1beta1 kind: ArgoCD metadata: name: example-argocd labels: example: repo spec: # ... monitoring: enabled: true # ...Verify whether an alert rule is included in the PrometheusRule created by the Operator:
Example alert rule:
apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: name: argocd-component-status-alert namespace: openshift-gitops spec: groups: - name: ArgoCDComponentStatus rules: # ... - alert: ApplicationSetControllerNotReady annotations: message: >- ApplicationSet controller deployment for the Argo CD instance in namespace "default" is not running expr: >- kube_statefulset_status_replicas{ statefulset="openshift-gitops-application-controller", namespace="openshift-gitops" } != kube_statefulset_status_replicas_ready{ statefulset="openshift-gitops-application-controller", namespace="openshift-gitops" } for: 1m labels: severity: criticalwhere:
spec.groups.name- Specifies the name of the alert rule group.
spec.groups.rules.alert- Specifies the name of the alert that triggers when workloads created by the Argo CD instance are not running as expected.
spec.groups.rules.annotations.message- Specifies a description of the alert condition.
spec.groups.rules.expr- Specifies the Prometheus expression that evaluates the alert condition.
spec.groups.rules.for- Specifies the duration for which the condition must be true before the alert fires.
spec.groups.rules.labels.severity- Specifies the severity level of the alert.
2.5.3. Disabling monitoring for Argo CD custom resource workloads Copier lienLien copié sur presse-papiers!
Disable workload monitoring for specific Argo CD instances when you no longer need alerts for component workloads. When disabled, the GitOps Operator automatically deletes the associated PrometheusRule object.
Procedure
Set the
.spec.monitoring.enabledfield value tofalseon a given Argo CD instance:Example Argo CD custom resource:
apiVersion: argoproj.io/v1beta1 kind: ArgoCD metadata: name: example-argocd labels: example: repo spec: # ... monitoring: enabled: false # ...
Verification
Verify that the
PrometheusRuleobject has been deleted:$ oc get prometheusrule -n <namespace>The
argocd-component-status-alertPrometheusRuleobject no longer appears in the list.