Skip to main content

Install the monitoring tools

When your cluster has no monitoring yet, install five open-source tools next to OpenLM Platform. Together they show what runs on the cluster, what each service uses, and what each request did. Install them in the order of this page, then turn on telemetry so that OpenLM Platform sends its data to them.

The following table lists what you install:

ToolWhat it does for youHelm chartNamespace
HeadlampShows what runs on the cluster at this moment, in a web UIheadlamp/headlampheadlamp
Prometheus and GrafanaPrometheus collects CPU, memory and service figures every 30 seconds. Grafana draws them, and the traces, as dashboards.prometheus-community/kube-prometheus-stackopenlm-telemetry
TempoStores the traces and counts the calls between servicesgrafana-community/tempoopenlm-telemetry
OpenTelemetry collectorReceives traces and metrics from OpenLM Platform and passes them onopen-telemetry/opentelemetry-collectoropenlm-telemetry
These tools see everything

Grafana and Headlamp show internal details of the cluster and of OpenLM Platform. The Headlamp chart gives Headlamp's service account the cluster-admin role, so anyone who signs in to Headlamp with its token can change or delete anything in the cluster. This page keeps both tools inside the cluster: you open them from your own machine with kubectl port-forward. Don't publish them on an ingress without sign-in protection in front of them. To limit what Headlamp can do, set the chart value clusterRoleBinding.clusterRoleName to a role with fewer rights.

Before you begin​

Make sure you have the following:

  • The tools from the requirements: kubectl, helm 3.12 or higher and openssl, as listed in Requirements.
  • Cluster administrator rights: the charts create cluster roles and custom resource definitions.
  • Room on the cluster: on a one-node test cluster, the tools used about 1.3 GiB of memory and little CPU, and their memory requests add up to about 1.2 GiB. Prometheus and Tempo each get a 5 GiB volume from your default storage class.
  • The namespaces openlm-telemetry and headlamp: the kubeadm playbook creates them. On other clusters, the commands on this page create them.
OpenShift

OpenShift comes with its own monitoring, which already runs a node exporter and Prometheus. Instead of this page, send the OpenLM Platform telemetry to an OpenTelemetry collector that you run on OpenShift, as described in Turn on telemetry.

Add the chart repositories​

Add the four chart repositories and download their indexes:

helm repo add headlamp https://kubernetes-sigs.github.io/headlamp/
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add grafana-community https://grafana-community.github.io/helm-charts
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo update

The commands on this page install fixed chart versions, the ones OpenLM tested together. To install newer versions, change --version and check the chart's release notes for changed values.

Create the namespaces and the Grafana password​

Create the namespaces, if they don't exist yet, and a random password for the Grafana administrator:

kubectl create namespace openlm-telemetry --dry-run=client -o yaml | kubectl apply -f -
kubectl create namespace headlamp --dry-run=client -o yaml | kubectl apply -f -
kubectl -n openlm-telemetry create secret generic grafana-admin \
--from-literal=admin-user=admin \
--from-literal=admin-password="$(openssl rand -base64 24)"

The password stays in the secret. You read it when you open the tools.

Install Prometheus and Grafana​

The kube-prometheus-stack chart installs Prometheus, Grafana, about two dozen ready-made Kubernetes dashboards, and the parts that collect the cluster's figures. Save the following file as kps-values.yaml:

alertmanager:
enabled: false # this page sets up dashboards, not alerts
# Prometheus can't reach these control-plane parts on most clusters:
# kubeadm serves them on the node itself only, EKS and AKS don't expose them
kubeControllerManager: { enabled: false }
kubeScheduler: { enabled: false }
kubeEtcd: { enabled: false }
kubeProxy: { enabled: false }
grafana:
admin:
existingSecret: grafana-admin
userKey: admin-user
passwordKey: admin-password
sidecar:
datasources:
alertmanager: { enabled: false }
additionalDataSources: # the traces in Tempo, linked to Prometheus for the service graph
- name: Tempo
uid: tempo
type: tempo
access: proxy
url: http://tempo.openlm-telemetry:3200
jsonData:
serviceMap: { datasourceUid: prometheus }
nodeGraph: { enabled: true }
resources:
requests: { cpu: 50m, memory: 128Mi }
limits: { memory: 512Mi }
prometheus:
prometheusSpec:
enableRemoteWriteReceiver: true # Tempo writes the call counts here
retention: 2d
retentionSize: 4GB
resources:
requests: { cpu: 100m, memory: 512Mi }
limits: { memory: 2Gi }
storageSpec:
volumeClaimTemplate:
spec:
accessModes: [ReadWriteOnce]
resources: { requests: { storage: 5Gi } }
# read ServiceMonitors from every namespace, not only from this release
serviceMonitorSelectorNilUsesHelmValues: false
podMonitorSelectorNilUsesHelmValues: false
prometheusOperator:
resources:
requests: { cpu: 20m, memory: 64Mi }
limits: { memory: 256Mi }
kube-state-metrics:
resources:
requests: { cpu: 10m, memory: 64Mi }
limits: { memory: 256Mi }
prometheus-node-exporter:
service: # 9100 is taken where an ingress controller on the
port: 9110 # host network uses it, as Traefik does on kubeadm
targetPort: 9110
resources:
requests: { cpu: 10m, memory: 32Mi }
limits: { memory: 128Mi }

Prometheus keeps 2 days of data, up to 4 GB. For a longer history, raise retention, retentionSize and the volume size together. If your cluster has no default storage class, add storageClassName: <class> under volumeClaimTemplate.spec.

Install the chart with the release name kps. The other files on this page use the service names that this release name produces.

helm upgrade --install kps prometheus-community/kube-prometheus-stack --version 93.4.0 \
-n openlm-telemetry -f kps-values.yaml --wait --timeout 15m

Install Tempo​

Tempo stores the traces and turns them into call counts for the service graph. Save the following file as tempo-values.yaml:

tempo:
reportingEnabled: false # no usage reports to Grafana Labs
retention: 48h # how long Tempo keeps each trace
resources:
requests: { cpu: 50m, memory: 128Mi }
limits: { memory: 1Gi }
metricsGenerator: # writes call counts and durations to Prometheus
enabled: true
remoteWriteUrl: http://kps-kube-prometheus-stack-prometheus.openlm-telemetry:9090/api/v1/write
storage:
path: /var/tempo/metrics # on the volume instead of /tmp
overrides:
defaults:
metrics_generator:
processors: [service-graphs, span-metrics]
persistence:
enabled: true
size: 5Gi

Install it:

helm upgrade --install tempo grafana-community/tempo --version 3.2.1 \
-n openlm-telemetry -f tempo-values.yaml --wait

Install the OpenTelemetry collector​

The collector receives what OpenLM Platform sends on port 4317. It passes the traces to Tempo and offers the metrics to Prometheus on port 8889. Save the following file as otel-values.yaml:

mode: deployment
fullnameOverride: otel-collector
image:
repository: otel/opentelemetry-collector-contrib
resources:
requests: { cpu: 50m, memory: 128Mi }
limits: { memory: 512Mi }
ports:
jaeger-compact: { enabled: false }
jaeger-thrift: { enabled: false }
jaeger-grpc: { enabled: false }
zipkin: { enabled: false }
prom-exporter:
enabled: true
containerPort: 8889
servicePort: 8889
protocol: TCP
config:
receivers:
jaeger: null
zipkin: null
exporters:
otlp:
endpoint: tempo.openlm-telemetry.svc.cluster.local:4317
tls: { insecure: true }
prometheus:
endpoint: ${env:MY_POD_IP}:8889
service:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlp]
metrics:
receivers: [otlp, prometheus]
processors: [memory_limiter, batch]
exporters: [prometheus]

Save the following file as otel-servicemonitor.yaml. It tells Prometheus to collect the metrics from the collector every 30 seconds:

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: otel-collector
namespace: openlm-telemetry
spec:
selector:
matchLabels:
app.kubernetes.io/name: opentelemetry-collector
app.kubernetes.io/instance: otel-collector
endpoints:
- port: prom-exporter
interval: 30s
honorLabels: true # keep each OpenLM service's own job label

Install the collector with the release name otel-collector, which the ServiceMonitor selects, and apply the ServiceMonitor:

helm upgrade --install otel-collector open-telemetry/opentelemetry-collector --version 0.180.0 \
-n openlm-telemetry -f otel-values.yaml --wait
kubectl apply -f otel-servicemonitor.yaml

Install Headlamp​

Install Headlamp:

helm upgrade --install headlamp headlamp/headlamp --version 0.46.0 -n headlamp --wait

Headlamp signs you in with a Kubernetes service account token. Create one each time you need it. This one expires after 24 hours:

kubectl -n headlamp create token headlamp --duration=24h

Load the OpenLM services dashboard​

The OpenLM services dashboard shows, for every OpenLM Platform service that sends traces, the requests per second, the failed requests, the 95th percentile response time, the slowest operations, the service graph and the slow traces, plus memory and restarts of the pods in the openlm namespace. The figures leave out health checks, so they reflect real calls.

Download the dashboard and load it into Grafana as a ConfigMap. Grafana picks up every ConfigMap with the label grafana_dashboard=1 within a minute:

curl -fsSLo openlm-services-dashboard.json \
https://www.openlm.com/documentation/files/kubernetes/openlm-services-dashboard.json
kubectl -n openlm-telemetry create configmap openlm-services-dashboard \
--from-file=openlm-services-dashboard.json
kubectl -n openlm-telemetry label configmap openlm-services-dashboard grafana_dashboard=1
Dashboards you make yourself

With these values, Grafana keeps its own data in a temporary folder of its pod. Dashboards that you create or change in Grafana are lost when the pod restarts. To keep a dashboard, export it as JSON and load it as a ConfigMap, like the OpenLM services dashboard.

Turn on telemetry​

The collector now waits for data. Follow Turn on telemetry with this collector address:

TELEMETRY__COLLECTORENDPOINT: "http://otel-collector.openlm-telemetry:4317"

Open the tools​

Open each tool from your machine through a port forward. Run each command in its own terminal and keep it running while you use the tool:

kubectl -n openlm-telemetry port-forward svc/kps-grafana 3000:80
kubectl -n headlamp port-forward svc/headlamp 4466:80
kubectl -n openlm-telemetry port-forward svc/kps-kube-prometheus-stack-prometheus 9090:9090

Then open the tools in a browser, as the following table shows:

ToolAddressSign in with
Grafanahttp://localhost:3000/User admin and the password from kubectl -n openlm-telemetry get secret grafana-admin -o jsonpath='{.data.admin-password}' | base64 -d
Headlamphttp://localhost:4466/The token from Install Headlamp
Prometheushttp://localhost:9090/No sign-in

Check that monitoring collects data​

Check that Prometheus reaches everything it collects from:

  1. In Prometheus, select Status, then Target health.

  2. Check that every target shows UP. The target serviceMonitor/openlm-telemetry/otel-collector/0 is the collector.

    Prometheus Target health page with the OpenTelemetry collector target up The collector's target is up, so Prometheus receives the OpenLM Platform metrics

  3. In Grafana, open Dashboards and then OpenLM services. After you turn on telemetry and use OpenLM Platform for a few minutes, the panels show data.

Check

Every target in Prometheus is up, and the OpenLM services dashboard counts services in Services sending traces.

To find problems with these tools, see Find problems with monitoring.

Remove the tools​

To remove the tools, turn telemetry off first, then uninstall the releases:

helm -n headlamp uninstall headlamp
helm -n openlm-telemetry uninstall otel-collector tempo kps
kubectl -n openlm-telemetry delete servicemonitor otel-collector
kubectl -n openlm-telemetry delete configmap openlm-services-dashboard
kubectl -n openlm-telemetry delete secret grafana-admin

The volumes of Prometheus and Tempo stay, and so do the custom resource definitions of kube-prometheus-stack. To free the storage, delete the volume claims with kubectl -n openlm-telemetry delete pvc --all.

The documentation team might draft this page using a large language model. A technical writer reviews every page and verifies it against the product before publishing it. A human makes the final decision.