Skip to content

Commit a7bfc76

Browse files
authored
Improve Kubernetes monitoring docs for k8s-monitoring v0.1.3 (#226)
Align with the updated chart values key and document OpenShift SCC steps for node exporter and kube-state-metrics.
1 parent 1a0eec3 commit a7bfc76

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

docs/monitor-kubernetes.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,32 @@ To set up monitoring of Kubernetes, you need the following:
2828

2929
### Install the Victoria Metrics Kubernetes monitoring stack
3030

31+
??? admonition "Install on OpenShift"
32+
33+
When installing the chart on OpenShift, some components might require additional Security Context Constraints (SCCs), depending on the permissions they need at runtime.
34+
35+
The `prometheus-node-exporter` component runs as a DaemonSet and requires access to host-level resources such as `/proc`, `/sys`, and other node-level paths. Because these are exposed through `hostPath` mounts, the service account used by `prometheus-node-exporter` must be granted an SCC that allows host access, such as `hostaccess`, `hostmount-anyuid`, or a custom SCC with equivalent permissions.
36+
37+
For example:
38+
39+
```bash
40+
oc adm policy add-scc-to-user node-exporter \
41+
-z prometheus-node-exporter \
42+
-n <namespace>
43+
```
44+
45+
Similarly, for `kube-state-metrics`, if the `restricted` SCC is enforced, avoid setting fixed user, group, or filesystem group IDs. Allow OpenShift to assign these values from the namespace UID/GID range by either adding the service account to the required SCC or by adding the following entries to the values YAML file:
46+
47+
```yaml
48+
kube-state-metrics:
49+
securityContext:
50+
runAsUser: null
51+
runAsGroup: null
52+
fsGroup: null
53+
```
54+
55+
Next, follow the steps to install Victoria Metrics Kubernetes Monitoring stack.
56+
3157
=== ":material-run-fast: Quick install"
3258

3359
Use the [quick install script](https://raw.githubusercontent.com/Percona-Lab/k8s-monitoring/refs/tags/{{k8s_monitor_tag}}/vm-operator-k8s-stack/quick-install.sh) and the set of flags that describe your PMM Server and Kubernetes environment to install Victoria Metrics Kubernetes monitoring stack with a single command. The script installs Victoria Metrics Kubernetes monitoring stack with default parameters.
@@ -174,14 +200,14 @@ To set up monitoring of Kubernetes, you need the following:
174200

175201
8. Install the Victoria Metrics Kubernetes monitoring stack Helm chart. You need to specify the following configuration:
176202

177-
* the URL to access the PMM server in the `externalVM.write.url` option in the format `<PMM-SERVER-URL>/victoriametrics/api/v1/write`. The URL can contain either the IP address or the hostname of the PMM server.
203+
* the URL to access the PMM server in the `external.vm.write.url` option is in the format `<PMM-SERVER-URL>/victoriametrics/api/v1/write`. The URL can contain either the IP address or the hostname of the PMM server.
178204
* the unique name or an ID of the Kubernetes cluster in the `vmagent.spec.externalLabels.k8s_cluster_id` option. Ensure to set different values if you are sending metrics from multiple Kubernetes clusters to the same PMM Server.
179205
* The Namespace must be the same as the Namespace for the Secret and ConfigMap
180206

181207
```bash
182208
helm install vm-k8s vm/victoria-metrics-k8s-stack \
183209
-f https://raw.githubusercontent.com/Percona-Lab/k8s-monitoring/refs/tags/{{k8s_monitor_tag}}/vm-operator-k8s-stack/values.yaml \
184-
--set externalVM.write.url=<PMM-SERVER-URL>/victoriametrics/api/v1/write \
210+
--set external.vm.write.url=<PMM-SERVER-URL>/victoriametrics/api/v1/write \
185211
--set vmagent.spec.externalLabels.k8s_cluster_id=<UNIQUE-CLUSTER-IDENTIFIER/NAME> \
186212
-n $NAMESPACE
187213
```
@@ -191,7 +217,7 @@ To set up monitoring of Kubernetes, you need the following:
191217
```bash
192218
helm install vm-k8s vm/victoria-metrics-k8s-stack \
193219
-f https://raw.githubusercontent.com/Percona-Lab/k8s-monitoring/refs/tags/{{k8s_monitor_tag}}/vm-operator-k8s-stack/values.yaml \
194-
--set externalVM.write.url=https://pmm-example.com/victoriametrics/api/v1/write \
220+
--set external.vm.write.url=https://pmm-example.com/victoriametrics/api/v1/write \
195221
--set vmagent.spec.externalLabels.k8s_cluster_id=test-cluster \
196222
-n monitoring-system
197223
```

variables.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ minikuberecommended: '1.38.1'
2020
binlogserverrecommended: '0.3.1'
2121

2222
#For monitoring
23-
k8s_monitor_tag: 'v0.1.2'
23+
k8s_monitor_tag: 'v0.1.3'
2424

2525
# Global variables
2626

0 commit comments

Comments
 (0)