Skip to content

Commit fdcc787

Browse files
committed
docs: add docs for monitoring
Document how to configure the monitoring using Prometheus and Grafana. Assisted-by: AI Signed-off-by: Alice Frosi <afrosi@redhat.com>
1 parent 0f604ae commit fdcc787

3 files changed

Lines changed: 90 additions & 0 deletions

File tree

‎docs/src/SUMMARY.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
- [Helm Chart](helm.md)
99
- [Operations](operations/index.md)
1010
- [Managing a pool](operations/pool.md)
11+
- [Monitoring](operations/monitoring.md)

‎docs/src/helm.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,8 @@ make helm
141141
| `image.pullPolicy` | not set | Kubernetes image pull policy |
142142
| `imagePullSecrets` | `[]` | List of pull secret references |
143143
| `controller.extraArgs` | `[]` | Extra arguments for the controller |
144+
| `metrics.enabled` | `true` | Deploy the metrics Service |
145+
| `metrics.service.port` | `8443` | Service port for the metrics endpoint |
146+
| `metrics.serviceMonitor.enabled` | `false` | Create a ServiceMonitor resource |
147+
| `metrics.serviceMonitor.interval` | `30s` | Scrape interval |
148+
| `metrics.serviceMonitor.namespace` | `""` | Namespace for the ServiceMonitor |

‎docs/src/operations/monitoring.md‎

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Monitoring
2+
3+
The Bootc Operator exposes Prometheus metrics on a secure HTTPS
4+
endpoint. This guide covers how to set up Prometheus and Grafana to
5+
scrape and visualize the operator metrics.
6+
7+
## Exposed metrics
8+
9+
The operator exposes the following custom metrics:
10+
11+
| Metric | Type | Labels | Description |
12+
|--------|------|--------|-------------|
13+
| `bootcoperator_pool_nodes_total` | Gauge | `pool` | Total number of nodes in a BootcNodePool |
14+
| `bootcoperator_pool_nodes_updated` | Gauge | `pool` | Nodes running the target digest |
15+
| `bootcoperator_pool_nodes_updating` | Gauge | `pool` | Nodes actively being updated |
16+
| `bootcoperator_pool_nodes_degraded` | Gauge | `pool` | Nodes in a degraded state |
17+
| `bootcoperator_pool_rollout_paused` | Gauge | `pool` | Whether rollout is paused (0 or 1) |
18+
| `bootcoperator_node_booted_image_info` | Gauge | `node`, `pool`, `image`, `digest`, `version` | Info metric for the booted OS image |
19+
20+
In addition to these custom metrics, the operator exposes standard
21+
controller-runtime metrics (workqueue depth, reconcile duration, etc.).
22+
23+
## Enabling the ServiceMonitor
24+
25+
The Helm chart includes a `ServiceMonitor` resource that tells
26+
Prometheus where to scrape. Enable it during install or upgrade:
27+
28+
```bash
29+
helm upgrade --install bootc-operator \
30+
oci://ghcr.io/bootc-dev/bootc-operator/charts/bootc-operator \
31+
--namespace bootc-operator \
32+
--set metrics.serviceMonitor.enabled=true
33+
```
34+
35+
Verify the ServiceMonitor was created:
36+
37+
```bash
38+
kubectl -n bootc-operator get servicemonitor
39+
```
40+
41+
## Installing Prometheus and Grafana
42+
43+
The recommended way to deploy Prometheus and Grafana is the
44+
[kube-prometheus-stack](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack)
45+
Helm chart:
46+
47+
```bash
48+
helm repo add prometheus-community \
49+
https://prometheus-community.github.io/helm-charts
50+
helm repo update
51+
52+
helm install monitoring prometheus-community/kube-prometheus-stack \
53+
--namespace monitoring --create-namespace \
54+
--set prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false
55+
```
56+
57+
Setting `serviceMonitorSelectorNilUsesHelmValues=false` allows
58+
Prometheus to discover ServiceMonitors from all namespaces, including
59+
`bootc-operator`.
60+
61+
## Granting Prometheus access to the metrics endpoint
62+
63+
The operator metrics endpoint requires authentication. The Helm chart
64+
creates a `ClusterRole` called `<release>-metrics-reader` that grants
65+
`GET` access to `/metrics`. Bind it to the Prometheus ServiceAccount:
66+
67+
```bash
68+
kubectl create clusterrolebinding prometheus-metrics-reader \
69+
--clusterrole=bootc-operator-metrics-reader \
70+
--serviceaccount=monitoring:monitoring-kube-prometheus-prometheus
71+
```
72+
73+
Adjust the ServiceAccount name if your Prometheus installation uses a
74+
different one.
75+
76+
## Helm values reference
77+
78+
| Key | Default | Description |
79+
|-----|---------|-------------|
80+
| `metrics.enabled` | `true` | Deploy the metrics Service |
81+
| `metrics.service.port` | `8443` | Service port for the metrics endpoint |
82+
| `metrics.serviceMonitor.enabled` | `false` | Create a ServiceMonitor resource |
83+
| `metrics.serviceMonitor.interval` | `30s` | Scrape interval |
84+
| `metrics.serviceMonitor.namespace` | `""` | Namespace for the ServiceMonitor (defaults to release namespace) |

0 commit comments

Comments
 (0)