Skip to content

Commit 4339001

Browse files
authored
Merge pull request #56235 from Srivaralakshmi/GitOps-RHDEVDOCS-4959
Document how to monitor Argo CD custom resource workloads
2 parents e99c383 + 19750d2 commit 4339001

4 files changed

+134
-0
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,6 +1862,8 @@ Topics:
18621862
File: configuring-argo-cd-rbac
18631863
- Name: Configuring Resource Quota
18641864
File: configuring-resource-quota
1865+
- Name: Monitoring Argo CD custom resource workloads
1866+
File: monitoring-argo-cd-custom-resource-workloads
18651867
- Name: Running Control Plane Workloads on Infra nodes
18661868
File: run-gitops-control-plane-workload-on-infra-nodes
18671869
- Name: Sizing requirements for GitOps Operator
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
:_content-type: ASSEMBLY
2+
[id="monitoring-argo-cd-custom-resource-workloads"]
3+
= Monitoring Argo CD custom resource workloads
4+
include::_attributes/common-attributes.adoc[]
5+
:context: monitoring-argo-cd-custom-resource-workloads
6+
7+
toc::[]
8+
9+
[role="_abstract"]
10+
With {gitops-title}, 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.
11+
12+
You can enable and disable the setting for monitoring Argo CD custom resource workloads.
13+
14+
// Prerequisites for monitoring Argo CD custom resource workloads
15+
[discrete]
16+
== Prerequisites
17+
18+
* You have access to the cluster as a user with the `cluster-admin` role.
19+
* {gitops-title} is installed in your cluster.
20+
* 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.
21+
* The `kube-state-metrics` service is running in your cluster.
22+
* Optional: If you are enabling monitoring for an Argo CD instance already present in a user-defined project, ensure that the monitoring is xref:../../monitoring/enabling-monitoring-for-user-defined-projects.html#enabling-monitoring-for-user-defined-projects_enabling-monitoring-for-user-defined-projects[enabled for user-defined projects] in your cluster.
23+
+
24+
[NOTE]
25+
====
26+
If 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 with `openshift-*`, then you must enable user workload monitoring in your cluster. This action enables the monitoring stack to pick up the created PrometheusRule.
27+
====
28+
29+
//Enabling Monitoring for Argo CD custom resource workloads
30+
include::modules/gitops-enabling-monitoring-for-argo-cd-custom-resource-workloads.adoc[leveloffset=+1]
31+
32+
//Disabling Monitoring for Argo CD custom resource workloads
33+
include::modules/gitops-disabling-monitoring-for-argo-cd-custom-resource-workloads.adoc[leveloffset=+1]
34+
35+
[role="_additional-resources"]
36+
[id="additional-resources_monitoring-argo-cd-custom-resource-workloads"]
37+
== Additional resources
38+
* xref:../../monitoring/enabling-monitoring-for-user-defined-projects.adoc#enabling-monitoring-for-user-defined-projects[Enabling monitoring for user-defined projects]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * /cicd/gitops/monitoring-argo-cd-custom-resource-workloads.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="gitops-disabling-monitoring-for-argo-cd-custom-resource-workloads_{context}"]
7+
= Disabling Monitoring for Argo CD custom resource workloads
8+
9+
You can disable workload monitoring for specific Argo CD instances. Disabling workload monitoring deletes the created PrometheusRule.
10+
11+
.Procedure
12+
13+
* Set the `.spec.monitoring.enabled` field value to `false` on a given Argo CD instance:
14+
+
15+
.Example Argo CD custom resource
16+
17+
[source,yaml]
18+
----
19+
apiVersion: argoproj.io/v1alpha1
20+
kind: ArgoCD
21+
metadata:
22+
name: example-argocd
23+
labels:
24+
example: repo
25+
spec:
26+
...
27+
monitoring:
28+
enabled: false
29+
...
30+
----
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * /cicd/gitops/monitoring-argo-cd-custom-resource-workloads.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="gitops-enabling-monitoring-for-argo-cd-custom-resource-workloads_{context}"]
7+
= Enabling Monitoring for Argo CD custom resource workloads
8+
9+
By default, the monitoring configuration for Argo CD custom resource workloads is set to `false`.
10+
11+
With {gitops-title}, 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.
12+
13+
.Procedure
14+
15+
. Set the `.spec.monitoring.enabled` field value to `true` on a given Argo CD instance:
16+
+
17+
.Example Argo CD custom resource
18+
19+
[source,yaml]
20+
----
21+
apiVersion: argoproj.io/v1alpha1
22+
kind: ArgoCD
23+
metadata:
24+
name: example-argocd
25+
labels:
26+
example: repo
27+
spec:
28+
...
29+
monitoring:
30+
enabled: true
31+
...
32+
----
33+
34+
. Verify whether an alert rule is included in the PrometheusRule created by the Operator:
35+
+
36+
.Example alert rule
37+
38+
[source,yaml]
39+
----
40+
apiVersion: monitoring.coreos.com/v1
41+
kind: PrometheusRule
42+
metadata:
43+
name: argocd-component-status-alert
44+
namespace: openshift-gitops
45+
spec:
46+
groups:
47+
- name: ArgoCDComponentStatus
48+
rules:
49+
...
50+
- alert: ApplicationSetControllerNotReady <1>
51+
annotations:
52+
message: >-
53+
applicationSet controller deployment for Argo CD instance in
54+
namespace "default" is not running
55+
expr: >-
56+
kube_statefulset_status_replicas{statefulset="openshift-gitops-application-controller statefulset",
57+
namespace="openshift-gitops"} !=
58+
kube_statefulset_status_replicas_ready{statefulset="openshift-gitops-application-controller statefulset",
59+
namespace="openshift-gitops"}
60+
for: 1m
61+
labels:
62+
severity: critical
63+
----
64+
<1> Alert rule in the PrometheusRule that checks whether the workloads created by the Argo CD instances are running as expected.

0 commit comments

Comments
 (0)