Chapter 2. Monitoring
2.1. Monitoring Argo CD instances Copy linkLink copied to clipboard!
By default, the Red Hat OpenShift GitOps Operator automatically detects an installed Argo CD instance in your defined namespace, for example, openshift-gitops
, and connects it to the monitoring stack of the cluster to provide alerts for out-of-sync applications.
2.1.1. Prerequisites Copy linkLink copied to clipboard!
-
You have access to the cluster with
cluster-admin
privileges. - You have access to the OpenShift Container Platform web console.
- You have installed the Red Hat OpenShift GitOps Operator in your cluster.
-
You have installed an Argo CD application in your defined namespace, for example,
openshift-gitops
.
2.1.2. Monitoring Argo CD health using Prometheus metrics Copy linkLink copied to clipboard!
You can monitor the health status of an Argo CD application by running Prometheus metrics queries against it.
Procedure
-
In the Developer perspective of the web console, select the namespace where your Argo CD application is installed, and navigate to Observe
Metrics. - From the Select query drop-down list, select Custom query.
To check the health status of your Argo CD 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)
sum(argocd_app_info{dest_namespace=~"<your_defined_namespace>",health_status!=""}) by (health_status)
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace the
<your_defined_namespace>
variable with the actual name of your defined namespace, for exampleopenshift-gitops
.
2.2. Monitoring health information for application resources and deployments Copy linkLink copied to clipboard!
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 the application resources, such as routes, synchronization status, deployment configuration, and deployment history.
The environments pages in the Developer perspective of the OpenShift Container Platform web console are decoupled from the Red Hat OpenShift GitOps Application Manager command-line interface (CLI), kam
. You do not have to use kam
to generate Application Environment manifests for the environments to show up in the Developer perspective of the OpenShift Container Platform web console. You can use your own manifests, but the environments must still be represented by namespaces. In addition, specific labels and annotations are still needed.
2.2.1. Settings for environment labels and annotations Copy linkLink copied to clipboard!
This section provides reference settings for environment labels and annotations required to display an environment application in the Environments page, in the Developer perspective of the Red Hat OpenShift GitOps web console.
Environment labels
The environment application manifest must contain labels.openshift.gitops/environment
and destination.namespace
fields. You must set identical values for the <environment_name>
variable and the name of the environment application manifest.
Specification of the environment application manifest
Example of an environment application manifest
- 1
- The name of the environment application manifest. The value set is the same as the value of the
<environment_name>
variable.
Environment annotations
The environment namespace manifest must contain the annotations.app.openshift.io/vcs-uri
and annotations.app.openshift.io/vcs-ref
fields to specify the version controller code source of the application. You must set identical values for the <environment_name>
variable and the name of the environment namespace manifest.
Specification of the environment namespace manifest
- 1
- The name of the environment namespace manifest. The value set is the same as the value of the
<environment_name>
variable.
Example of an environment namespace manifest
2.2.2. Checking health information Copy linkLink copied to clipboard!
The Red Hat OpenShift GitOps Operator will install the GitOps backend service in the openshift-gitops
namespace.
Prerequisites
- The Red Hat OpenShift GitOps Operator is installed from OperatorHub.
- Ensure that your applications are synchronized by Argo CD.
Procedure
- Click Environments under the Developer perspective. 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, if the Resources section under the Overview tab displays icons, hover over the icons to get status details.
- A broken heart indicates that resource issues have degraded the application’s performance.
- A yellow yield sign indicates that resource issues have delayed data about the application’s health.
- To view the deployment history of an application, click the Deployment History tab. The page includes details such as the Last deployment, Description (commit message), Environment, Author, and Revision.
2.3. Monitoring Argo CD custom resource workloads Copy linkLink copied to clipboard!
With Red Hat OpenShift GitOps, you can monitor the availability of Argo CD custom resource workloads for specific Argo CD instances. By monitoring Argo CD custom resource workloads, you have the latest information about the state of your Argo CD instances by enabling alerts for them. When the component workload pods such as application-controller, repo-server, or server of the corresponding Argo CD instance are unable to come up for certain reasons and there is a drift between the number of ready replicas and the number of desired replicas for a certain period of time, the Operator then triggers the alerts.
You can enable and disable the setting for monitoring Argo CD custom resource workloads.
2.3.1. Prerequisites Copy linkLink copied to clipboard!
-
You have access to the cluster as a user with the
cluster-admin
role. - Red Hat OpenShift GitOps is installed in your cluster.
-
The monitoring stack is configured in your cluster in the
openshift-monitoring
project. In addition, the Argo CD instance is in a namespace that you can monitor through Prometheus. -
The
kube-state-metrics
service is running in 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-monitoring
stack, 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.3.2. Enabling Monitoring for Argo CD custom resource workloads Copy linkLink copied to clipboard!
By default, the monitoring configuration for Argo CD custom resource workloads is set to false
.
With Red Hat OpenShift GitOps, you can enable workload monitoring for specific Argo CD instances. As a result, the Operator creates a PrometheusRule
object that contains alert rules for all the workloads managed by the specific Argo CD instances. These alert rules trigger the firing of an alert when the replica count of the corresponding component has drifted from the desired state for a certain amount of time. The Operator will not overwrite the changes made to the PrometheusRule
object by the users.
Procedure
Set the
.spec.monitoring.enabled
field value totrue
on a given Argo CD instance:Example Argo CD custom resource
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify whether an alert rule is included in the PrometheusRule created by the Operator:
Example alert rule
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Alert rule in the PrometheusRule that checks whether the workloads created by the Argo CD instances are running as expected.
2.3.3. Disabling Monitoring for Argo CD custom resource workloads Copy linkLink copied to clipboard!
You can disable workload monitoring for specific Argo CD instances. Disabling workload monitoring deletes the created PrometheusRule.
Procedure
Set the
.spec.monitoring.enabled
field value tofalse
on a given Argo CD instance:Example Argo CD custom resource
Copy to Clipboard Copied! Toggle word wrap Toggle overflow