Day 11: Observability – the lending statistics
Goal: monitor Qdrant with kube-prometheus-stack: read the metrics of a pod, let Prometheus query despite the key and TLS, ask questions in PromQL, define an SLO, write alerts and trigger them twice for real – through overload and through a failed node · Duration: about 150 min · Prerequisite: Day 0 to Day 10
State before this chapter
Three Qdrant pods are running with TLS, an API key, NetworkPolicies
and Pod Security restricted.
# on vdb1
kubectl -n qdrant get pods -o wideExpected (your IPs, nodes and ages will differ):
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
qdrant-0 1/1 Running 0 14m 10.42.1.56 vdb2 <none> <none>
qdrant-1 1/1 Running 0 13m 10.42.3.32 vdb4 <none> <none>
qdrant-2 1/1 Running 0 16m 10.42.2.16 vdb3 <none> <none>
Since Day 10, every call needs: https://,
--cacert ~/labor/tag10/ca.crt and a key from
~/labor/tag10 – lese-key for reading,
admin-key for managing. /metrics also answers
with 401 without a key. Prometheus pods need the label
qdrant-zugriff=ja, otherwise the gatekeeper does not let
them through.
Introduction
Until today you have queried every state yourself:
kubectl get pods, /cluster, a load run with
last-prozesse.py. That is enough in the lab. In production
nobody checks at three in the morning – there a system has to notice by
itself that searches are getting slow or a copy is missing, and wake
someone up.
Today you build this supervision. Prometheus collects the counter readings of every Qdrant pod every 15 seconds, rules calculate from them how well the library keeps its promise, and Alertmanager raises the alarm if it does not. Along the way you hit three stumbling blocks that lurk in almost every cluster: a line break in the key, a certificate without the pod address, and a label that Prometheus silently renames.
Today you will learn:
- to read the metrics of a single Qdrant pod and to distinguish counters, gauges and histograms,
- to install kube-prometheus-stack sparingly on one node,
- to write a ServiceMonitor with an API key and your own CA – and to interpret its error patterns,
- to calculate requests per second, p50/p99 and error rate in PromQL,
- to define an SLO and express it as recording rules and alerts,
- to ship a Grafana dashboard as a ConfigMap,
- to trigger one alert through overload and one through a node failure, and watch them disappear again.
Background
The picture of the day: the lending statistics
Every branch of the city library has a tally counter at its counter desk. It counts every inquiry, sorted by type and outcome, and notes how long it took – not each individual time, but in compartments: “under 5 ms”, “under 10 ms”, “under 50 ms” and so on. The tally counter only stands at the desk; nobody carries the numbers anywhere on their own.
The statistics office (Prometheus) sends a messenger to every branch every 15 seconds, who copies down the counter readings. Who visits which branch is on the visiting list (ServiceMonitor). The messenger needs a reader’s card and has to be able to check the branch’s seal – like any other visitor.
From the counter readings the office calculates key figures: inquiries per minute, share of slow inquiries. The city has given the library a service promise (SLO): 99 out of 100 inquiries in under 50 ms. The one permitted percent is the error budget. If it is used up too quickly, the caretaker’s alarm clock (Alertmanager) rings. The wall board in the foyer (Grafana) shows the curves for everyone.
The terms
| Term | Meaning | In the picture |
|---|---|---|
| metrics endpoint | /metrics of each pod, text in the Prometheus
format |
tally counter at the desk |
| counter | count that only rises (until restart) | tally sheet |
| gauge | measured value that can rise and fall | thermometer |
| histogram | count per duration bucket (le = “less than or equal”),
cumulative |
compartments by waiting time |
| Prometheus | collects metrics (pull), stores them as time series | statistics office |
| ServiceMonitor | tells the Prometheus Operator which services to query and how | visiting list |
| target | a single queried endpoint (here: one pod) | one branch on the list |
| PromQL | Prometheus’s query language | the office’s calculation rule |
| SLI / SLO | measured indicator / target value for it | key figure / service promise |
| error budget | the misses the SLO allows (here 1%) | permitted exceptions |
| recording rule | query that Prometheus continuously precomputes and stores | monthly statistics |
| alerting rule | condition that fires an alert after a waiting time
(for) |
alarm clock rule |
| Alertmanager | groups, silences and sends alerts | caretaker’s alarm clock |
| Grafana | dashboards based on Prometheus | wall board in the foyer |
Remember: The tally counter counts, the office calculates, the alarm clock wakes. If one of them is missing, nobody notices the water damage until the readers complain.
Drill 1: A branch’s tally counter
Where you are: on vdb1.
What you have afterwards: a load generator that works with a key and TLS, and the metrics of a Qdrant pod that you can interpret line by line.
Step 1 – create the working folder and change into it.
# on vdb1
mkdir -p ~/labor/tag11# on vdb1
cd ~/labor/tag11Step 2 – adopt the load generator.
last-prozesse.py from Day 8 still speaks plain HTTP without
a key. You copy it and convert it following the pattern of
lesen.py from Day 10.
# on vdb1
cp ../tag08/last-prozesse.py .# on vdb1
nano last-prozesse.py"""Lastgenerator mit Prozessen statt Threads: jeder Prozess ist ein eigener Leser mit eigenem Python."""
import ssl
import sys
import time
from multiprocessing import Pool
import numpy as np
from qdrant_client import QdrantClient, models
QDRANT, COLLECTION, FRAGEN = sys.argv[1], sys.argv[2], sys.argv[3]
PARALLEL, ANZAHL = int(sys.argv[4]), int(sys.argv[5])
EF = int(sys.argv[6]) if len(sys.argv) > 6 else None # hnsw_ef, ohne Angabe = Standard
def leser(nummer):
"""Ein Prozess: schickt seine Anfragen nacheinander und gibt die Zeiten zurück."""
fragen = np.load(FRAGEN)
schluessel = open("../tag10/lese-key").read().strip()
ca = ssl.create_default_context(cafile="../tag10/ca.crt")
client = QdrantClient(url=QDRANT, api_key=schluessel, verify=ca, timeout=30,
check_compatibility=False)
parameter = models.SearchParams(hnsw_ef=EF)
zeiten, fehler = [], 0
for i in range(nummer, ANZAHL, PARALLEL):
beginn = time.perf_counter()
try:
client.query_points(COLLECTION, query=fragen[i % len(fragen)].tolist(), limit=10,
search_params=parameter)
except Exception:
fehler += 1
zeiten.append((time.perf_counter() - beginn) * 1000)
return zeiten, fehler
if __name__ == "__main__":
start = time.perf_counter()
with Pool(PARALLEL) as pool:
ergebnisse = pool.map(leser, range(PARALLEL))
dauer = time.perf_counter() - start
zeiten = np.concatenate([z for z, f in ergebnisse])
fehler = sum(f for z, f in ergebnisse)
p50, p95, p99 = np.percentile(zeiten, [50, 95, 99])
print(f"parallel {PARALLEL} (Prozesse) · {ANZAHL} Anfragen in {dauer:.1f} s"
f" · {ANZAHL / dauer:.0f} Anfragen/s · p50 {p50:.1f} ms · p95 {p95:.1f} ms"
f" · p99 {p99:.1f} ms · max {zeiten.max():.1f} ms · Fehler {fehler}")| Line | Meaning |
|---|---|
import ssl |
for the TLS context with your own CA |
open("../tag10/lese-key")…strip() |
read-only key from the file, without the line break |
ssl.create_default_context(cafile=…) |
trusts the Stadtbibliothek CA from Day 10 |
api_key=…, verify=ca |
key as the api-key header, verify the certificate |
check_compatibility=False |
switches off the version check at startup – on Day 10 it produced a warning on every run, here it would even be once per process |
Each process reads the key and CA itself, because
multiprocessing cannot share the client between
processes.
Step 3 – generate load. 16 readers together send
8,000 search requests to doku. The requests are not the
purpose today; they fill the tally counter.
# on vdb1
~/werkbank/bin/python last-prozesse.py https://10.43.151.237:6333 doku ../tag01/fragen.npy 16 8000https://10.43.151.237:6333is theqdrantservice, now with TLS; the IP is in the certificate as a SAN.16 8000means 16 processes, 8,000 requests in total.
Expected:
parallel 16 (Prozesse) · 8000 Anfragen in 15.8 s · 505 Anfragen/s · p50 25.4 ms · p95 47.7 ms · p99 97.6 ms · max 336.0 ms · Fehler 0
505 requests per second, 0 errors – the key and TLS cost no measurable throughput compared to Day 8 (455 with 16 readers, without TLS; repetitions there varied by more than 10%).
Step 4 – copy down qdrant-0’s tally counter. Via the
service you end up at a random pod. But you want exactly one: with
--resolve you send the request to the pod IP of
qdrant-0 while using a name that is in the certificate. You
read the pod IP from the output in “State before this chapter”.
# on vdb1
curl -sS --resolve qdrant-0.qdrant-headless:6333:10.42.1.56 --cacert ../tag10/ca.crt -H "api-key: $(cat ../tag10/lese-key)" -o metriken-qdrant-0.txt https://qdrant-0.qdrant-headless:6333/metrics| Item | Value | Meaning |
|---|---|---|
--resolve |
qdrant-0.qdrant-headless:6333:10.42.1.56 |
this name and port go to this IP, without DNS |
--cacert |
../tag10/ca.crt |
verify the certificate with your own CA |
-H "api-key: …" |
read-only key | /metrics has needed an ID card since Day 10 |
-o |
metriken-qdrant-0.txt |
response into a file instead of letting it scroll across the screen |
Expected: no output. How much is it?
# on vdb1
wc -l metriken-qdrant-0.txtExpected:
227 metriken-qdrant-0.txt
Step 5 – the counters. You look for the lines that count responses.
# on vdb1
grep -E "^(rest|grpc)_responses_total" metriken-qdrant-0.txtExpected (your numbers will differ – the counter has been running since the pod started):
rest_responses_total{method="POST",endpoint="/collections/{collection_name}/points/query",status="200"} 98440
rest_responses_total{method="POST",endpoint="/collections/{collection_name}/points/query",status="400"} 1
rest_responses_total{method="POST",endpoint="/collections/{collection_name}/points/delete",status="200"} 1
| Part | Meaning |
|---|---|
rest_responses_total |
name; _total is the convention for counters |
{method=…,endpoint=…,status=…} |
labels: a separate time series for each combination |
endpoint="/collections/{collection_name}/…" |
the path as a pattern – the collection is not in it |
98440 |
this many searches with status 200 this pod has answered since it started |
Two things stand out. First, Qdrant only counts endpoints that matter
for operations: searching, writing, deleting. Calls to
/metrics and /readyz do not show up, even
though the kubelet and you send them constantly. Second, there is no
line at all for gRPC, because nobody used gRPC today – a time series
only comes into existence with the first request of its kind.
Step 6 – the histogram.
# on vdb1
grep "^rest_responses_duration_seconds" metriken-qdrant-0.txtExpected (excerpt – only the lines for
points/query):
rest_responses_duration_seconds_bucket{method="POST",endpoint="/collections/{collection_name}/points/query",status="200",le="0.001"} 0
rest_responses_duration_seconds_bucket{method="POST",endpoint="/collections/{collection_name}/points/query",status="200",le="0.005"} 758
rest_responses_duration_seconds_bucket{method="POST",endpoint="/collections/{collection_name}/points/query",status="200",le="0.01"} 16994
rest_responses_duration_seconds_bucket{method="POST",endpoint="/collections/{collection_name}/points/query",status="200",le="0.02"} 47570
rest_responses_duration_seconds_bucket{method="POST",endpoint="/collections/{collection_name}/points/query",status="200",le="0.05"} 88186
rest_responses_duration_seconds_bucket{method="POST",endpoint="/collections/{collection_name}/points/query",status="200",le="0.1"} 97814
rest_responses_duration_seconds_bucket{method="POST",endpoint="/collections/{collection_name}/points/query",status="200",le="0.5"} 98440
rest_responses_duration_seconds_bucket{method="POST",endpoint="/collections/{collection_name}/points/query",status="200",le="1"} 98440
rest_responses_duration_seconds_bucket{method="POST",endpoint="/collections/{collection_name}/points/query",status="200",le="5"} 98440
rest_responses_duration_seconds_bucket{method="POST",endpoint="/collections/{collection_name}/points/query",status="200",le="10"} 98440
rest_responses_duration_seconds_bucket{method="POST",endpoint="/collections/{collection_name}/points/query",status="200",le="50"} 98440
rest_responses_duration_seconds_bucket{method="POST",endpoint="/collections/{collection_name}/points/query",status="200",le="+Inf"} 98440
rest_responses_duration_seconds_sum{method="POST",endpoint="/collections/{collection_name}/points/query",status="200"} 2554.621471
rest_responses_duration_seconds_count{method="POST",endpoint="/collections/{collection_name}/points/query",status="200"} 98440
| Line | Meaning |
|---|---|
_bucket{…,le="0.05"} 88186 |
88,186 searches took at most 50 ms – the buckets are cumulative |
_bucket{…,le="+Inf"} |
all searches, equal to _count |
_sum |
sum of all durations in seconds |
_count |
number of all searches |
From these lines you can already calculate by hand: 88,186 of 98,440
searches were under 50 ms, that is 89.6%. The mean is
_sum / _count = 2,554.6 s / 98,440 = 26 ms. A histogram
gives you no more than that: whether a search took 21 or 49 ms is not in
any bucket. That is why bucket boundaries matter – the boundary of your
SLO should be one of them. Qdrant has buckets at 1, 5, 10, 20, 50, 100
and 500 ms.
The 89.6% comes from all runs since the pod started, including the overload experiments later in this chapter. For a statement about “now” you need the change over a time window – which is exactly what Prometheus calculates.
Step 7 – holdings and council.
# on vdb1
grep -E "^(collection_points|collection_dead_replicas|cluster_peers_total|cluster_term|memory_resident_bytes)" metriken-qdrant-0.txtExpected:
collection_points{id="doku"} 13220
collection_points{id="glove"} 424230
collection_points{id="verteilt"} 8518
collection_dead_replicas 0
cluster_peers_total 3
cluster_term 332
memory_resident_bytes 133799936
| Metric | Type | Meaning |
|---|---|---|
collection_points{id=…} |
gauge | points in the shards on this pod –
glove has 1,183,514 points, 424,230 of them are here |
collection_dead_replicas |
gauge | copies this pod knows as Dead; any value above 0 means data risk |
cluster_peers_total |
gauge | members of the council |
cluster_term |
gauge | the council’s term from Day 7; if it jumps, there was an election |
memory_resident_bytes |
gauge | memory of the process, 128 MiB |
Remember: Each pod only counts what happens at its own desk and what is on its own shelves. A statement about the whole library only comes about when someone copies down all tally counters and adds them up.
Save your progress? Sign up for free
Drill 2: Opening the statistics office
Where you are: on vdb1.
What you have afterwards: Prometheus, Alertmanager, Grafana and their helpers in the
monitoringnamespace, all on vdb1, with your own Grafana password.
kube-prometheus-stack bundles the Prometheus Operator, Prometheus, Alertmanager, Grafana, kube-state-metrics and node-exporter along with ready-made rules for Kubernetes. The workers vdb3 and vdb4 only have 2 vCPUs – that is why everything except node-exporter goes onto vdb1.
Step 1 – create the namespace.
# on vdb1
kubectl create namespace monitoringExpected:
namespace/monitoring created
Step 2 – your own Grafana password. Without a setting, the chart sets a well-known default password for Grafana. You generate a random one as on Day 10.
# on vdb1
openssl rand -hex -out grafana-passwort 16# on vdb1
chmod 600 grafana-passwort-hex … 16generates 16 random bytes as 32 hex characters,-outwrites them into the file.chmod 600allows only you to read it.
# on vdb1
kubectl -n monitoring create secret generic grafana-admin --from-literal=admin-user=admin --from-file=admin-password=grafana-passwort--from-literal=admin-user=admin– the user name is not a secret.--from-file=admin-password=grafana-passwort– the password comes from the file, not from the shell history.
Expected:
secret/grafana-admin created
Step 3 – the values file.
# on vdb1
nano monitoring-werte.yaml# kube-prometheus-stack 94.5.0 für das Labor: alles auf vdb1, Speicher klein
defaultRules:
rules:
etcd: false
kubeControllerManager: false
kubeSchedulerAlerting: false
kubeSchedulerRecording: false
kubeProxy: false
kubeEtcd:
enabled: false
kubeControllerManager:
enabled: false
kubeScheduler:
enabled: false
kubeProxy:
enabled: false
prometheusOperator:
nodeSelector:
kubernetes.io/hostname: vdb1
kube-state-metrics:
nodeSelector:
kubernetes.io/hostname: vdb1
prometheus:
prometheusSpec:
nodeSelector:
kubernetes.io/hostname: vdb1
podMetadata:
labels:
qdrant-zugriff: "ja"
scrapeInterval: 15s
retention: 2d
serviceMonitorSelectorNilUsesHelmValues: false
ruleSelectorNilUsesHelmValues: false
resources:
requests:
cpu: 200m
memory: 512Mi
limits:
memory: 2Gi
alertmanager:
alertmanagerSpec:
nodeSelector:
kubernetes.io/hostname: vdb1
grafana:
nodeSelector:
kubernetes.io/hostname: vdb1
admin:
existingSecret: grafana-admin
grafana.ini:
auth.anonymous:
enabled: true
org_role: Viewer| Section | Meaning |
|---|---|
defaultRules.rules.*: false, kubeEtcd …
kubeProxy: enabled: false |
k3s bundles etcd, scheduler, controller manager and kube-proxy in
one process without the usual metrics ports. Without these lines, four
targets would permanently be down, and their alerts would
always fire |
nodeSelector: kubernetes.io/hostname: vdb1 |
operator, kube-state-metrics, Prometheus, Alertmanager and Grafana only on vdb1 |
podMetadata.labels.qdrant-zugriff: "ja" |
the label that the NetworkPolicy leser-und-werkbank
from Day 10 requires |
scrapeInterval: 15s |
the messenger comes every 15 seconds |
retention: 2d |
keep time series for two days |
serviceMonitorSelectorNilUsesHelmValues: false |
Prometheus takes every ServiceMonitor, not only
those with the label release: monitoring |
ruleSelectorNilUsesHelmValues: false |
the same for PrometheusRules |
resources |
512 MiB requested, at most 2 GiB |
admin.existingSecret: grafana-admin |
user and password from your Secret |
auth.anonymous with org_role: Viewer |
view dashboards without logging in, but change nothing – convenient in the lab, off in production |
Prometheus gets no volume: its data lives in an emptyDir
and is gone when the pod moves to another node. For a lab that looks
back two days that is enough; in production a PersistentVolume belongs
with it (Enterprise note).
Step 4 – install.
# on vdb1
helm install monitoring oci://ghcr.io/prometheus-community/charts/kube-prometheus-stack --version 94.5.0 -n monitoring -f monitoring-werte.yaml --wait --timeout 10m| Item | Value | Meaning |
|---|---|---|
monitoring |
release name | prefix of all objects |
oci://ghcr.io/…/kube-prometheus-stack |
chart | directly from the OCI registry, no helm repo add |
--version |
94.5.0 |
fixed chart version |
-n |
monitoring |
namespace |
-f |
monitoring-werte.yaml |
your values |
--wait --timeout 10m |
return only when everything is ready, at most 10 minutes |
Expected (excerpt – notes from the chart follow afterwards):
Pulled: ghcr.io/prometheus-community/charts/kube-prometheus-stack:94.5.0
Digest: sha256:611ba5d72fc0f2b83c1e2401c857d4da6262c5740612cb86712c12dd63fa2948
NAME: monitoring
LAST DEPLOYED: Sun Dec 6 01:02:43 2026
NAMESPACE: monitoring
STATUS: deployed
REVISION: 1
DESCRIPTION: Install complete
The notes afterwards explain how to read the Grafana password from
the Secret monitoring-grafana. Check that:
# on vdb1
kubectl -n monitoring get secret monitoring-grafanaExpected:
Error from server (NotFound): secrets "monitoring-grafana" not found
The notes are hard-coded in the chart and know nothing about
existingSecret. Your password is in
grafana-passwort – you see it with
cat grafana-passwort when you want to log in.
Step 5 – what runs where?
# on vdb1
kubectl -n monitoring get pods -o wideExpected (truncated on the right):
NAME READY STATUS RESTARTS AGE IP NODE
alertmanager-monitoring-kube-prometheus-alertmanager-0 2/2 Running 0 2m21s 10.42.0.26 vdb1
monitoring-grafana-6c9c57c75b-lgxtc 3/3 Running 0 2m42s 10.42.0.24 vdb1
monitoring-kube-prometheus-operator-7ccdcb47cf-rg55v 1/1 Running 0 2m42s 10.42.0.25 vdb1
monitoring-kube-state-metrics-596b6bb859-x5jtr 1/1 Running 0 2m42s 10.42.0.23 vdb1
monitoring-prometheus-node-exporter-4dt4m 1/1 Running 0 2m42s 172.16.0.228 vdb4
monitoring-prometheus-node-exporter-pf52f 1/1 Running 0 2m42s 172.16.0.126 vdb2
monitoring-prometheus-node-exporter-tbsq7 1/1 Running 0 2m42s 172.16.0.83 vdb3
monitoring-prometheus-node-exporter-vh27b 1/1 Running 0 2m42s 172.16.0.182 vdb1
prometheus-monitoring-kube-prometheus-prometheus-0 2/2 Running 0 2m20s 10.42.0.27 vdb1
| Pod | Task |
|---|---|
prometheus-…-0 |
the statistics office; a second container
config-reloader reloads changed configuration |
alertmanager-…-0 |
the alarm clock |
monitoring-grafana-… |
the wall board; 3 containers, two of them load dashboards and data sources from ConfigMaps |
monitoring-kube-prometheus-operator-… |
translates ServiceMonitor and PrometheusRule into Prometheus configuration |
monitoring-kube-state-metrics-… |
turns the state of the Kubernetes objects into metrics |
monitoring-prometheus-node-exporter-… |
one pod per node (DaemonSet), with the node IP: CPU, memory, disks |
Step 6 – note the addresses.
# on vdb1
kubectl -n monitoring get svcExpected:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
alertmanager-operated ClusterIP None <none> 9093/TCP,9094/TCP,9094/UDP 2m23s
monitoring-grafana ClusterIP 10.43.253.37 <none> 80/TCP 2m44s
monitoring-kube-prometheus-alertmanager ClusterIP 10.43.189.94 <none> 9093/TCP,8080/TCP 2m44s
monitoring-kube-prometheus-operator ClusterIP 10.43.200.56 <none> 443/TCP 2m44s
monitoring-kube-prometheus-prometheus ClusterIP 10.43.23.41 <none> 9090/TCP,8080/TCP 2m44s
monitoring-kube-state-metrics ClusterIP 10.43.122.58 <none> 8080/TCP 2m44s
monitoring-prometheus-node-exporter ClusterIP 10.43.97.9 <none> 9100/TCP 2m44s
prometheus-operated ClusterIP None <none> 9090/TCP 2m22s
In the rest of the chapter, Prometheus is at
10.43.23.41:9090, Alertmanager at
10.43.189.94:9093 and Grafana at
10.43.253.37:80. Insert your own addresses. vdb1 reaches
cluster IPs directly.
Step 7 – whom does the messenger visit? The
Prometheus API returns the list of all targets. You save it and count
per job with jq.
# on vdb1
curl -sS http://10.43.23.41:9090/api/v1/targets -o ziele.json# on vdb1
jq -r '.data.activeTargets[] | [.labels.job, .health] | @tsv' ziele.json | sort | uniq -cjqprints one line “job, state” per target,sort | uniq -cmerges identical lines and counts them.
Expected:
1 apiserver up
1 coredns up
1 kube-state-metrics up
12 kubelet up
1 monitoring-grafana up
2 monitoring-kube-prometheus-alertmanager up
1 monitoring-kube-prometheus-operator up
2 monitoring-kube-prometheus-prometheus up
4 node-exporter up
All targets up, no Qdrant. Prometheus does not know the
library yet.
Remember: A freshly installed statistics office only visits Kubernetes itself. Every application joins only with its own visiting list.
Save your progress? Sign up for free
Drill 3: The visiting list – ServiceMonitor with ID card and seal
Where you are: on vdb1.
What you have afterwards: three Qdrant pods as targets in the
upstate – after two real error patterns that you recognize by their error message.
Step 1 – the first ServiceMonitor. It selects Qdrant’s headless service. Its endpoints are the three pods, and the operator turns each one into its own target.
# on vdb1
nano servicemonitor.yamlapiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: qdrant
namespace: qdrant
spec:
selector:
matchLabels:
app.kubernetes.io/name: qdrant
app.kubernetes.io/component: cluster-discovery
endpoints:
- port: http
path: /metrics
interval: 15s
scheme: https
authorization:
type: Bearer
credentials:
name: qdrant-schluessel
key: lesen
tlsConfig:
ca:
secret:
name: qdrant-tls
key: ca.crt| Item | Meaning |
|---|---|
namespace: qdrant |
the ServiceMonitor lives with the application; Secrets it points to must be in the same namespace |
selector.matchLabels |
only the qdrant-headless service has
component: cluster-discovery; selecting both services would
mean querying every pod twice |
port: http |
the port name in the service (6333) |
scheme: https |
TLS |
authorization.type: Bearer |
sends Authorization: Bearer <key> – Qdrant also
accepts the API key this way |
credentials |
Secret qdrant-schluessel, entry lesen from
Day 10 |
tlsConfig.ca.secret |
the CA from the Secret qdrant-tls, entry
ca.crt |
# on vdb1
kubectl apply -f servicemonitor.yamlExpected:
servicemonitor.monitoring.coreos.com/qdrant created
Step 2 – take a look. The operator needs a moment until the new configuration is loaded into Prometheus. Wait about a minute, then:
# on vdb1
curl -sS http://10.43.23.41:9090/api/v1/targets -o ziele.json# on vdb1
jq -r '.data.activeTargets[] | select(.labels.namespace=="qdrant") | [.labels.job, .labels.pod, .health, .lastError] | @tsv' ziele.jsonselect(.labels.namespace=="qdrant")keeps only the targets from theqdrantnamespace.@tsvprints the fields separated by tabs.
Expected:
qdrant-headless qdrant-0 down Get "https://10.42.1.56:6333/metrics": net/http: invalid header field value for "Authorization"
qdrant-headless qdrant-2 down Get "https://10.42.2.16:6333/metrics": net/http: invalid header field value for "Authorization"
qdrant-headless qdrant-1 down Get "https://10.42.3.32:6333/metrics": net/http: invalid header field value for "Authorization"
The job is named like the service, qdrant-headless.
Prometheus does not even send the request. The value for the header is invalid. Step 3 – the line break. How many characters does the read-only key have?
# on vdb1
wc -c ../tag10/lese-keyExpected:
65 ../tag10/lese-key
64 hex characters and a line break:
openssl rand -hex -out writes a \n at the end,
and --from-file took it into the Secret on Day 10.
curl with $(cat …) does not notice, because
the shell cuts off the final line break. And Qdrant reads the same value
from the Secret and still accepts keys without the line break – it
apparently strips it when loading. Prometheus takes the value literally,
and a line break is forbidden in an HTTP header.
You create a separate Secret without the line break for Prometheus.
tr -d "\n" deletes all line breaks.
# on vdb1
tr -d "\n" < ../tag10/lese-key > lese-key-prometheus# on vdb1
wc -c lese-key-prometheusExpected:
64 lese-key-prometheus
# on vdb1
kubectl -n qdrant create secret generic prometheus-lesen --from-file=lesen=lese-key-prometheusExpected:
secret/prometheus-lesen created
# on vdb1
rm lese-key-prometheusA separate Secret has a second advantage: Prometheus does not depend on the Secret from which Qdrant itself reads its keys.
Step 4 – switch the ServiceMonitor over.
# on vdb1
nano servicemonitor.yamlapiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: qdrant
namespace: qdrant
spec:
selector:
matchLabels:
app.kubernetes.io/name: qdrant
app.kubernetes.io/component: cluster-discovery
endpoints:
- port: http
path: /metrics
interval: 15s
scheme: https
authorization:
type: Bearer
credentials:
name: prometheus-lesen
key: lesen
tlsConfig:
ca:
secret:
name: qdrant-tls
key: ca.crt# on vdb1
kubectl apply -f servicemonitor.yamlExpected:
servicemonitor.monitoring.coreos.com/qdrant configured
After just under a minute, run curl … -o ziele.json
again, then jq without the job column:
# on vdb1
jq -r '.data.activeTargets[] | select(.labels.namespace=="qdrant") | [.labels.pod, .health, .lastError] | @tsv' ziele.jsonExpected:
qdrant-0 down Get "https://10.42.1.56:6333/metrics": tls: failed to verify certificate: x509: certificate is valid for 10.43.151.237, not 10.42.1.56
qdrant-2 down Get "https://10.42.2.16:6333/metrics": tls: failed to verify certificate: x509: certificate is valid for 10.43.151.237, not 10.42.2.16
qdrant-1 down Get "https://10.42.3.32:6333/metrics": tls: failed to verify certificate: x509: certificate is valid for 10.43.151.237, not 10.42.3.32
The key is now fine; the connection fails one stage earlier: at the seal.
Step 5 – the seal and the pod address. Prometheus
calls each pod via its IP and checks whether this IP is in the
certificate. The certificate from Day 10 names the service IP
10.43.151.237 and names such as
qdrant.qdrant.svc and qdrant-0.qdrant-headless
– but no pod IPs. Those change with every restart, so they do not belong
in it either. Instead, you tell Prometheus which name it should expect
in the certificate: serverName. All three pods carry the
same certificate, so qdrant.qdrant.svc fits each of
them.
# on vdb1
nano servicemonitor.yamlapiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: qdrant
namespace: qdrant
spec:
selector:
matchLabels:
app.kubernetes.io/name: qdrant
app.kubernetes.io/component: cluster-discovery
endpoints:
- port: http
path: /metrics
interval: 15s
scheme: https
authorization:
type: Bearer
credentials:
name: prometheus-lesen
key: lesen
tlsConfig:
ca:
secret:
name: qdrant-tls
key: ca.crt
serverName: qdrant.qdrant.svc# on vdb1
kubectl apply -f servicemonitor.yamlExpected:
servicemonitor.monitoring.coreos.com/qdrant configured
Give Prometheus two minutes this time. In the lab, a look after just
under a minute still showed the old x509 error: the operator writes the
configuration into a Secret, and the config-reloader in the
Prometheus pod notices the change only with a delay. Then run
curl … -o ziele.json again, this time with the time of the
last scrape:
# on vdb1
jq -r '.data.activeTargets[] | select(.labels.namespace=="qdrant") | [.labels.pod, .health, .lastError, .lastScrape] | @tsv' ziele.jsonExpected:
qdrant-1 up 2026-12-06T01:10:38.933189695Z
qdrant-0 up 2026-12-06T01:10:42.469065181Z
qdrant-2 up 2026-12-06T01:10:40.364720726Z
Three targets up, lastError empty. The
gatekeeper from Day 10 let the messenger through because the Prometheus
pod carries the label qdrant-zugriff=ja.
Remember: A target that is
downtells you inlastErrorat which door the messenger failed – header, seal or gatekeeper. Read the error before you turn knobs in the configuration.
Save your progress? Sign up for free
Drill 4: Questions for the office – PromQL
Where you are: on vdb1, with two terminals.
What you have afterwards: requests per second per pod, p50 and p99 of the searches and the error rate – from Prometheus instead of from the load generator, and the reason why the first query stays empty.
Step 1 – load in the first terminal. 40,000 requests run for about a minute and a half – enough time for the queries in the second terminal. If the time is not enough for all steps, simply start the run once more; in the lab it ran twice, and the values from Step 4 onwards come from the second run.
# on vdb1 – Terminal 1
~/werkbank/bin/python last-prozesse.py https://10.43.151.237:6333 doku ../tag01/fragen.npy 16 40000Step 2 – the first question. In the second terminal,
wait about a minute, then ask for search requests per second per pod.
rate(…[1m]) is the increase of the counter per second,
averaged over the last minute; sum by (pod) combines the
time series per pod.
# on vdb1 – Terminal 2
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query=sum by (pod) (rate(rest_responses_total{endpoint=~".*/points/query"}[1m]))' | jq -c '.data.result'| Item | Meaning |
|---|---|
/api/v1/query |
a query at the current point in time |
--data-urlencode 'query=…' |
the PromQL query, safely encoded |
endpoint=~".*/points/query" |
=~ compares against a regular expression |
jq -c '.data.result' |
only the result, compact |
Expected:
[]
Empty. The target is up, the numbers are in the tally
counter – what is the reason?
Step 3 – check the labels. You query the time series without the endpoint filter and look at which labels Prometheus has stored.
# on vdb1 – Terminal 2
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query=rest_responses_total{pod="qdrant-0"}' | jq -c '.data.result[].metric'Expected:
{"__name__":"rest_responses_total","container":"qdrant","endpoint":"http","exported_endpoint":"/collections/{collection_name}/points/query","instance":"10.42.1.56:6333","job":"qdrant-headless","method":"POST","namespace":"qdrant","pod":"qdrant-0","service":"qdrant-headless","status":"200"}
{"__name__":"rest_responses_total","container":"qdrant","endpoint":"http","exported_endpoint":"/collections/{collection_name}/points/query","instance":"10.42.1.56:6333","job":"qdrant-headless","method":"POST","namespace":"qdrant","pod":"qdrant-0","service":"qdrant-headless","status":"400"}
endpoint here is http – the port name from
the ServiceMonitor. The operator attaches a label endpoint
with the name of the scraped port to every time series. But Qdrant
itself supplies a label endpoint. In such a collision the
target label wins, and Prometheus renames the application’s label to
exported_endpoint. This happens without a warning.
Step 4 – the right question. With
exported_endpoint instead of endpoint:
# on vdb1 – Terminal 2
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query=sum by (pod) (rate(rest_responses_total{exported_endpoint=~".*/points/query"}[1m]))' | jq -c '.data.result[] | [.metric.pod, .value[1]]'Expected (your values will differ):
["qdrant-1","114.55555555555554"]
["qdrant-2","182.00604390720824"]
["qdrant-0","218.98053506354995"]
Together 515 searches per second, unevenly distributed: qdrant-1 on vdb4 with 2 vCPUs gets the fewest. The service distributes connections, not requests. Each of the 16 processes opens a connection and keeps it; which pod gets how many processes is chance – and a slow pod answers fewer requests over its connections in the same time.
Step 5 – p99 and p50 from the histogram.
histogram_quantile estimates a quantile from the buckets.
First you combine the buckets of all pods with sum by (le)
– the le must be preserved.
# on vdb1 – Terminal 2
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query=histogram_quantile(0.99, sum by (le) (rate(rest_responses_duration_seconds_bucket{exported_endpoint=~".*/points/query"}[1m])))' | jq -c '.data.result[] | .value[1]'Expected:
"0.04925281267804928"
# on vdb1 – Terminal 2
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query=histogram_quantile(0.50, sum by (le) (rate(rest_responses_duration_seconds_bucket{exported_endpoint=~".*/points/query"}[1m])))' | jq -c '.data.result[] | .value[1]'Expected:
"0.014938333896392477"
p99 49 ms, p50 15 ms – measured in the server. The p99 value lies in
the bucket between 20 and 50 ms; histogram_quantile assumes
that the searches are evenly distributed across the bucket and
interpolates linearly. This number is no more precise than the bucket
boundaries.
Step 6 – the share of fast searches. For an SLO you do not need an estimate: the share of searches under 50 ms is directly in the buckets.
# on vdb1 – Terminal 2
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query=sum(rate(rest_responses_duration_seconds_bucket{exported_endpoint=~".*/points/query",le="0.05"}[1m])) / sum(rate(rest_responses_duration_seconds_count{exported_endpoint=~".*/points/query"}[1m]))' | jq -c '.data.result[] | .value[1]'Expected:
"0.9956724889715883"
99.57% of the searches in the last minute were under 50 ms.
Step 7 – the error rate. Share of responses with status 5xx among all responses of the last five minutes:
# on vdb1 – Terminal 2
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query=sum(rate(rest_responses_total{status=~"5.."}[5m])) / sum(rate(rest_responses_total[5m]))' | jq -c '.data.result'Expected:
[]
Empty again – this time for a different reason. There was not a
single 5xx response today, so there is no time series with
status="5.." either. The sum over nothing is nothing, and
nothing divided by something is nothing as well. “No result” is not “0”.
That is why you add or vector(0) in the rules in Drill
5.
Step 8 – the result in the first terminal.
Expected:
parallel 16 (Prozesse) · 40000 Anfragen in 81.4 s · 491 Anfragen/s · p50 28.5 ms · p95 51.8 ms · p99 67.0 ms · max 259.1 ms · Fehler 0
| Key figure | Load generator (client) | Prometheus (server) |
|---|---|---|
| requests/s | 491 | 515 (one minute in the middle of the run) |
| p50 | 28.5 ms | 15 ms |
| p99 | 67.0 ms | 49 ms |
The client measures more: Python, encryption and the network add to the time spent in the server. An SLO on server metrics says how fast the library is – not how long a reader waits. For the reader’s view you would need measuring points at the client (Enterprise note).
Remember: Prometheus can only add up what it knows. An empty answer means either “wrong label” or “that never happened” – neither is a zero.
Save your progress? Sign up for free
Drill 5: The service promise – SLO and rules
Where you are: on vdb1.
What you have afterwards: an SLO, three recording rules, four alerts in one PrometheusRule.
You define the SLO for the library:
- Search speed: 99% of searches take at most 50 ms in the server. 50 ms is a bucket boundary of the histogram. The error budget is 1% slow searches.
- Availability: at most 1% of requests end with 5xx.
On top of that, two alerts for states that no reader notices right away: a pod that no longer delivers metrics, and a dead shard copy.
Step 1 – the rules.
# on vdb1
nano regeln.yamlapiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: qdrant-slo
namespace: qdrant
spec:
groups:
- name: qdrant-sli
rules:
- record: qdrant:suche_anfragen:rate1m
expr: sum by (pod) (rate(rest_responses_total{exported_endpoint=~".*/points/query"}[1m]))
- record: qdrant:suche_langsam:anteil5m
expr: |
1 - sum(rate(rest_responses_duration_seconds_bucket{exported_endpoint=~".*/points/query",le="0.05"}[5m]))
/ sum(rate(rest_responses_duration_seconds_count{exported_endpoint=~".*/points/query"}[5m]))
- record: qdrant:fehler:anteil5m
expr: |
(sum(rate(rest_responses_total{status=~"5.."}[5m])) or vector(0))
/ sum(rate(rest_responses_total[5m]))
- name: qdrant-alarme
rules:
- alert: QdrantPodFehlt
expr: up{job="qdrant-headless"} == 0
for: 1m
labels:
severity: critical
annotations:
summary: "Qdrant-Pod {{ $labels.pod }} liefert seit 1 Minute keine Metriken"
- alert: QdrantSucheZuLangsam
expr: qdrant:suche_langsam:anteil5m > 0.05
for: 2m
labels:
severity: warning
annotations:
summary: "{{ $value | humanizePercentage }} der Suchen brauchen länger als 50 ms (SLO: 1 %)"
- alert: QdrantFehlerquote
expr: qdrant:fehler:anteil5m > 0.01
for: 2m
labels:
severity: critical
annotations:
summary: "{{ $value | humanizePercentage }} der Anfragen enden mit 5xx"
- alert: QdrantReplikatTot
expr: max(collection_dead_replicas) > 0
for: 1m
labels:
severity: critical
annotations:
summary: "Mindestens eine Shard-Kopie ist Dead"| Rule | Meaning |
|---|---|
record: qdrant:suche_anfragen:rate1m |
searches per second per pod; the name follows the pattern
level:metric:operation |
record: qdrant:suche_langsam:anteil5m |
1 minus the share under 50 ms = share of slow searches over 5 minutes – the SLI |
record: qdrant:fehler:anteil5m |
share of 5xx; or vector(0) turns “no 5xx time series”
into a 0 |
QdrantPodFehlt |
a Qdrant target is down, for: 1m – for one
minute, so that a single missed visit does not wake anyone |
QdrantSucheZuLangsam |
more than 5% slow searches, for two minutes |
QdrantFehlerquote |
more than 1% 5xx, for two minutes |
QdrantReplikatTot |
any pod reports a Dead copy |
severity |
label by which Alertmanager can route later (critical
wakes, warning does not) |
{{ $value \| humanizePercentage }} |
puts the value into the text as a percentage |
Why does QdrantSucheZuLangsam only fire at 5% and not at
1%? At exactly 1%, the budget is used up after 30 days – nobody needs to
be woken at night for that. 5% over several minutes means the budget is
melting five times as fast as allowed. That is the idea behind alerts on
the burn rate; the Enterprise note shows the complete
form with two time windows.
Step 2 – apply.
# on vdb1
kubectl apply -f regeln.yamlExpected:
prometheusrule.monitoring.coreos.com/qdrant-slo created
Step 3 – does Prometheus have the rules? After about a minute:
# on vdb1
curl -sS http://10.43.23.41:9090/api/v1/rules -o regeln.json# on vdb1
jq -r '.data.groups[] | select(.name|startswith("qdrant")) | .rules[] | [.type, .name, .health, (.state // "-")] | @tsv' regeln.jsonExpected:
alerting QdrantPodFehlt ok inactive
alerting QdrantSucheZuLangsam ok inactive
alerting QdrantFehlerquote ok inactive
alerting QdrantReplikatTot ok inactive
recording qdrant:suche_anfragen:rate1m ok -
recording qdrant:suche_langsam:anteil5m ok -
recording qdrant:fehler:anteil5m ok -
health ok means the query runs without errors.
inactive means the condition is not met.
Step 4 – the precomputed values. All three recording
rules at once: __name__ is the label for the name of a time
series.
# on vdb1
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query={__name__=~"qdrant:.*"}' | jq -c '.data.result[] | [.metric.__name__, .metric.pod, .value[1]]'Expected:
["qdrant:suche_anfragen:rate1m","qdrant-1","0"]
["qdrant:suche_anfragen:rate1m","qdrant-2","0"]
["qdrant:suche_anfragen:rate1m","qdrant-0","0"]
["qdrant:suche_langsam:anteil5m",null,"0.006824980844687634"]
["qdrant:fehler:anteil5m",null,"0"]
Right now nobody is searching (0 per second), but the last five minutes still contain the end of the run from Drill 4: 0.68% slow searches – within the budget of 1%. And the error rate is now a real 0 instead of an empty answer.
Remember: An SLO is a number with a window and a bucket boundary: “99% under 50 ms, measured over 5 minutes”. The alert does not fire at the first violation, but when the budget melts too quickly.
Save your progress? Sign up for free
Drill 6: The wall board – Grafana
Where you are: on vdb1 and on your computer.
What you have afterwards: a dashboard “Qdrant – Ausleihstatistik” that comes with a ConfigMap and is created without clicking.
Grafana has a sidecar container that searches all ConfigMaps with the
label grafana_dashboard: "1" for dashboards and loads them.
A dashboard as a file lives in Git; one clicked together by hand lives
only in Grafana’s database – which, without a volume here, would be gone
at the next restart.
Step 1 – the dashboard as a ConfigMap.
# on vdb1
nano dashboard.yamlapiVersion: v1
kind: ConfigMap
metadata:
name: qdrant-dashboard
namespace: monitoring
labels:
grafana_dashboard: "1"
data:
qdrant.json: |
{
"title": "Qdrant – Ausleihstatistik",
"uid": "qdrant-ausleihe",
"time": {"from": "now-30m", "to": "now"},
"refresh": "30s",
"panels": [
{"type": "timeseries", "title": "Suchanfragen/s je Pod",
"gridPos": {"x": 0, "y": 0, "w": 12, "h": 8},
"targets": [{"expr": "qdrant:suche_anfragen:rate1m", "legendFormat": "{{pod}}"}]},
{"type": "timeseries", "title": "Suchdauer im Server (p50, p99)",
"gridPos": {"x": 12, "y": 0, "w": 12, "h": 8},
"fieldConfig": {"defaults": {"unit": "s"}},
"targets": [
{"expr": "histogram_quantile(0.50, sum by (le) (rate(rest_responses_duration_seconds_bucket{exported_endpoint=~\".*/points/query\"}[1m])))", "legendFormat": "p50"},
{"expr": "histogram_quantile(0.99, sum by (le) (rate(rest_responses_duration_seconds_bucket{exported_endpoint=~\".*/points/query\"}[1m])))", "legendFormat": "p99"}]},
{"type": "timeseries", "title": "Anteil Suchen über 50 ms (SLO 1 %)",
"gridPos": {"x": 0, "y": 8, "w": 12, "h": 8},
"fieldConfig": {"defaults": {"unit": "percentunit"}},
"targets": [{"expr": "qdrant:suche_langsam:anteil5m", "legendFormat": "langsam"}]},
{"type": "stat", "title": "Punkte je Collection, alle Kopien zusammen",
"gridPos": {"x": 12, "y": 8, "w": 12, "h": 8},
"options": {"colorMode": "none", "graphMode": "none"},
"targets": [{"expr": "sum by (id) (collection_points)", "legendFormat": "{{id}}"}]}
]
}| Part | Meaning |
|---|---|
labels.grafana_dashboard: "1" |
this is how the sidecar container recognizes a dashboard |
uid |
fixed identifier, determines the URL
/d/qdrant-ausleihe |
gridPos |
position and size: 24 columns wide, height in grid units |
targets[].expr |
PromQL; two panels use the recording rules from Drill 5 |
legendFormat: "{{pod}}" |
label per time series taken from a label |
unit |
s for seconds, percentunit for shares
0–1 |
colorMode: none |
numbers without traffic-light colors – point counts are neither good nor bad |
A data source appears nowhere: without one specified, Grafana takes the default source, and the chart sets up Prometheus as the default.
# on vdb1
kubectl apply -f dashboard.yamlExpected:
configmap/qdrant-dashboard created
Step 2 – has it arrived? Grafana’s search API is open to anonymous viewers.
# on vdb1
curl -sS 'http://10.43.253.37/api/search?query=Qdrant' | jq -r '.[] | [.uid, .title] | @tsv'Expected:
qdrant-ausleihe Qdrant – Ausleihstatistik
Step 3 – the board in the browser. Grafana only has a cluster IP. From your computer you build an SSH tunnel to vdb1 that forwards port 3000 on your computer to the Grafana IP.
# on your computer
ssh -N -L 3000:10.43.253.37:80 [email protected]-L 3000:10.43.253.37:80– connections tolocalhost:3000go via vdb1 to Grafana.-N– do not open a shell, only forward. The command keeps running until you end it withCtrl+C.
Open http://localhost:3000/d/qdrant-ausleihe in the
browser. You see the dashboard without logging in, as a viewer. To make
changes, log in as admin with the password from
grafana-passwort.
Empty? The curves need searches. In Drill 7 the board gets plenty to show.
Remember: Dashboards belong in files, not in clicks. What Grafana loads from a ConfigMap at startup survives every restart and every reinstallation.
Save your progress? Sign up for free
Drill 7: Water damage from a rush – alert on overload
Where you are: on vdb1, with two terminals, and in the browser.
What you have afterwards: experienced the alert
QdrantSucheZuLangsamfrompendingthroughfiringto disappearing – and seen why it keeps firing for five minutes after the load ends.
Step 1 – a rush. 48 readers send 200,000 requests; that takes about seven minutes. On Day 8, with 32 readers, 1% of searches were already above 120 ms.
# on vdb1 – Terminal 1
~/werkbank/bin/python last-prozesse.py https://10.43.151.237:6333 doku ../tag01/fragen.npy 48 200000Step 2 – watch. In the second terminal you query the share of slow searches and repeat the command every 30 seconds.
# on vdb1 – Terminal 2
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query=qdrant:suche_langsam:anteil5m' | jq -r '.data.result[0].value[1]'Plus the state of the alert:
# on vdb1 – Terminal 2
curl -sS http://10.43.23.41:9090/api/v1/alerts | jq -r '.data.alerts[] | [.labels.alertname, .state] | @tsv'In the lab, the two commands at 30-second intervals gave these values (load from about 01:17:20):
| Time | Share slow | QdrantSucheZuLangsam |
|---|---|---|
| 01:17:48 | 0.116 | pending |
| 01:18:18 | 0.149 | pending |
| 01:18:48 | 0.176 | pending |
| 01:19:18 | 0.188 | pending |
| 01:19:48 | 0.181 | firing |
| 01:22:49 | 0.154 | firing |
| 01:26:20 | 0.159 | firing |
Just 30 seconds after the start, more than 5% of searches were above
50 ms; the alert went to pending. After the two minutes
from for: 2m it became firing.
Step 3 – has it reached the alarm clock?
Alertmanager has its own API. Only alerts in the firing
state end up there.
# on vdb1 – Terminal 2
curl -sS http://10.43.189.94:9093/api/v2/alerts | jq -r '.[] | [.labels.alertname, .labels.severity, .status.state, .annotations.summary] | @tsv'Expected:
QdrantSucheZuLangsam warning active 18.76% der Suchen brauchen länger als 50 ms (SLO: 1 %)
InfoInhibitor none suppressed Info-level alert inhibition.
Watchdog none active An alert that should always be firing to certify that Alertmanager is working properly.
| Alert | Meaning |
|---|---|
QdrantSucheZuLangsam |
yours, with the value in the text: 18.76% instead of the permitted 1% |
Watchdog |
always fires. If it stops arriving at an external receiver, the monitoring itself is broken |
InfoInhibitor |
helper alert from the chart, suppresses alerts with
severity: info |
Where Alertmanager sends alerts (mail, chat, pager) is not set up here; in the lab the API is enough. The Enterprise note says what belongs to it. Step 4 – the end of the load. In the first terminal:
Expected:
parallel 48 (Prozesse) · 200000 Anfragen in 424.6 s · 471 Anfragen/s · p50 64.7 ms · p95 153.9 ms · p99 214.4 ms · max 576.6 ms · Fehler 0
0 errors. For a reader the library was reachable – just slower than the promise allows. That is exactly what the latency SLO is for: an availability alert would have stayed silent here.
Step 5 – when does the alert disappear? Prometheus
keeps the history of every alert as the time series ALERTS.
With query_range you query a time range – insert your own
times.
# on vdb1
curl -sS http://10.43.23.41:9090/api/v1/query_range --data-urlencode 'query=ALERTS{alertname="QdrantSucheZuLangsam"}' --data-urlencode start=2026-12-06T01:15:00Z --data-urlencode end=2026-12-06T01:45:00Z --data-urlencode step=30s | jq -r '.data.result[] | .metric.alertstate + " " + (.values[0][0]|todate) + " bis " + (.values[-1][0]|todate)'| Item | Meaning |
|---|---|
query_range |
query over a time range instead of at a point in time |
start, end |
time range in UTC |
step=30s |
one value every 30 seconds |
.values[0][0], .values[-1][0] |
first and last point in time, todate turns them into
date and time |
Expected:
firing 2026-12-06T01:19:30Z bis 2026-12-06T01:29:00Z
pending 2026-12-06T01:17:30Z bis 2026-12-06T01:19:00Z
The load ended around 01:24:20, the alert fired until 01:29:00 –
almost five minutes longer. This is not a bug: after the end, the
[5m] window still contains five minutes of rush. Because
nobody searches afterwards, neither the buckets nor the counter rise,
and the share stays at 15%. Only when the window is empty does 0 / 0
become NaN – and NaN > 0.05 is false.
# on vdb1
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query=qdrant:suche_langsam:anteil5m' | jq -c '.data.result'Expected:
[{"metric":{"__name__":"qdrant:suche_langsam:anteil5m"},"value":[1796521721.890,"NaN"]}]
Without searches there is no SLI. A latency alert therefore cannot
report a total outage in which not a single request arrives any more –
that is what QdrantPodFehlt is for.
Step 6 – the board. This is what the dashboard looked like for the runs from Drill 4 and this drill:
| Panel | What you see |
|---|---|
| Suchanfragen/s je Pod | on the left the run from Drill 4 is missing: recording rules only calculate from when they were created (01:15). The first step around 01:16 comes from two short preliminary runs we used to determine the load size for this drill. From 01:22, qdrant-0 and qdrant-2 drop to 0, qdrant-1 keeps working alone |
| Suchdauer im Server | p99 first around 50 ms (Drill 4), under the rush above 400 ms, then around 250 ms. From 01:22, p99 drops to 100 ms |
| Anteil Suchen über 50 ms | rises to 19%, holds 15% for five minutes after the end of the load and breaks off at 01:29 |
| Punkte je Collection | doku and verteilt show 26,440 = 2 ×
13,220, because every copy counts; glove has no copies |
Why does qdrant-1 work alone from 01:22? Each of the 48 processes has
its fixed share of around 4,167 requests. The processes connected to
qdrant-0 and qdrant-2 on the faster nodes were done after a good five
minutes. Those on qdrant-1 (vdb4, 2 vCPUs) needed two minutes longer.
During that time only a third of the load was still running – that is
why p99 drops. A query with increase provides the
numbers:
# on vdb1
curl -sS http://10.43.23.41:9090/api/v1/query_range --data-urlencode 'query=sum by (pod,status) (increase(rest_responses_total{exported_endpoint=~".*/points/query"}[1m]))' --data-urlencode start=2026-12-06T01:20:00Z --data-urlencode end=2026-12-06T01:26:00Z --data-urlencode step=60s | jq -c '.data.result[] | [.metric.pod,.metric.status, [.values[][1]|tonumber|floor]]'Expected:
["qdrant-0","200",[13646,12164,488,0,0,0,0]]
["qdrant-0","400",[0,0,0,0,0,0,0]]
["qdrant-1","200",[10477,10728,14185,14510,14706,4694,0]]
["qdrant-2","200",[16102,15573,2344,0,0,0,0]]
Searches per minute per pod, from 01:20 to 01:26. A load generator with fixed shares ends up measuring the slowest pod. For statements about the whole cluster, only the section in which all readers were running counts.
Remember: A latency alert sees a rush that no availability alert sees – but it sees nothing when nobody asks any more. And it keeps ringing for as long as its window is.
Save your progress? Sign up for free
Drill 8: Power cut in a branch – alert on node failure
Where you are: on vdb4 and vdb1.
What you have afterwards:
QdrantPodFehltandQdrantReplikatTottriggered for real and resolved again, and an idea of how loud a single node failure is in the default rules.
Step 1 – adopt the write script. A dead copy
requires a write operation during the outage (Day 7). You copy
schreiben.py from Day 7 and convert it to the admin key and
TLS.
# on vdb1
cp ../tag07/schreiben.py .# on vdb1
nano schreiben.py"""Schreibt einzelne Testpunkte in eine Collection und meldet jeden Erfolg oder Fehler."""
import ssl
import sys
import time
import numpy as np
from qdrant_client import QdrantClient, models
QDRANT, COLLECTION, START, ANZAHL = sys.argv[1], sys.argv[2], int(sys.argv[3]), int(sys.argv[4])
vektoren = np.load("../tag01/vektoren.npy")
schluessel = open("../tag10/admin-key").read().strip()
ca = ssl.create_default_context(cafile="../tag10/ca.crt")
client = QdrantClient(url=QDRANT, api_key=schluessel, verify=ca, timeout=5,
check_compatibility=False)
for nummer in range(START, START + ANZAHL):
punkt = models.PointStruct(id=nummer, vector=vektoren[nummer % len(vektoren)].tolist(),
payload={"quelle": "tag11"})
try:
client.upsert(COLLECTION, points=[punkt], wait=True)
print(f"{time.strftime('%T')} Punkt {nummer}: geschrieben", flush=True)
except Exception as e:
print(f"{time.strftime('%T')} Punkt {nummer}: FEHLER {str(e).splitlines()[0][:100]}", flush=True)- Writing needs the admin key; with the read-only key you would get 403.
payloadis nowtag11, so that you recognize the test points.
Step 2 – make vdb4 fail hard. As on Day 6:
k3s-killall.sh stops the k3s agent and all containers, the
VM keeps running. qdrant-1 runs on vdb4.
# on vdb4
sudo /usr/local/bin/k3s-killall.shThe session may hang in the process, because the script also tears down the pod network; then close the terminal. In the lab the command ran at 01:50:22.
Step 3 – the office notices. Two minutes later on vdb1:
# on vdb1
curl -sS http://10.43.23.41:9090/api/v1/alerts | jq -r '.data.alerts[] | [.labels.alertname, .state] | @tsv'In the lab, at 01:52:26, there were 19 alerts in the
list besides Watchdog – from a single node: six times
KubePodNotReady (qdrant-1, node-exporter and four Longhorn
pods), three times TargetDown, three times
KubeDaemonSetRolloutStuck, plus
KubeNodeNotReady, KubeNodeUnreachable,
KubeletInstanceUnreachable,
KubeStatefulSetReplicasMismatch,
KubeDaemonSetMisScheduled,
KubePdbNotEnoughHealthyPods – all pending.
Only one was already firing: QdrantPodFehlt
for qdrant-1. The default rules mostly wait 15 minutes
(for: 15m), yours only one.
Step 4 – write during the outage.
# on vdb1
~/werkbank/bin/python schreiben.py https://10.43.151.237:6333 verteilt 911000 4Expected:
01:54:43 Punkt 911000: FEHLER The read operation timed out
01:54:48 Punkt 911001: FEHLER The read operation timed out
01:54:48 Punkt 911002: geschrieben
01:54:48 Punkt 911003: geschrieben
The same picture as on Day 7: the first two write operations wait for the copy on vdb4 and run into the timeout, after that the council marks it as Dead, and things continue.
Step 5 – the dead copy in the metrics. About a minute later:
# on vdb1
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query=collection_dead_replicas' | jq -r '.data.result[] | [.metric.pod, .value[1]] | @tsv'Expected:
qdrant-2 2
qdrant-0 2
Both remaining pods know two Dead copies – the two shards of
verteilt that live on qdrant-1. qdrant-1 itself reports
nothing; after all, it is gone.
# on vdb1
curl -sS http://10.43.23.41:9090/api/v1/alerts | jq -r '.data.alerts[] | select(.labels.alertname|startswith("Qdrant")) | [.labels.alertname, (.labels.pod // "-"), .state, .activeAt] | @tsv'Expected:
QdrantPodFehlt qdrant-1 firing 2026-12-06T01:50:51.841072321Z
QdrantReplikatTot - pending 2026-12-06T01:55:21.841072321Z
activeAt is the moment when the condition was first met:
29 seconds after the outage for the pod, half a minute after the write
for the copy.
Step 6 – what reaches the alarm clock. A minute later you ask Alertmanager for its groups. Alertmanager combines alerts with the same grouping labels into one message.
# on vdb1
curl -sS http://10.43.189.94:9093/api/v2/alerts/groups | jq -r '.[] | [.labels.namespace // "-", (.alerts|length), ([.alerts[].labels.alertname]|unique|join(","))] | @tsv'Expected:
- 1 Watchdog
- 1 QdrantReplikatTot
qdrant 1 QdrantPodFehlt
Of the 19 alerts, only your two are at the alarm clock – the others are still waiting out their 15 minutes. If the node becomes healthy again in that time, nobody ever saw it. That is intentional: short disruptions should not wake anyone. For a database that loses copies, however, 15 minutes is too long – that is why it has its own, faster rules.
Step 7 – switch the power back on.
# on vdb4
sudo systemctl start k3s-agentThen on vdb1 you repeat two commands every 20 seconds:
# on vdb1
kubectl -n qdrant get pod qdrant-1# on vdb1
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query=max(collection_dead_replicas)' | jq -r '.data.result[0].value[1]'In the lab (agent start at 01:57:01) the result was the following, together with the state of the alerts:
| Time | qdrant-1 | Dead copies | Alerts |
|---|---|---|---|
| 01:57:03 | 0/1 Unknown |
2 | PodFehlt firing, ReplikatTot firing |
| 01:57:24 | 0/1 Running, 9 s |
2 | PodFehlt firing, ReplikatTot firing |
| 01:58:05 | 0/1 Running, 51 s |
2 | PodFehlt pending, ReplikatTot firing |
| 01:58:46 | 1/1 Running, 92 s |
0 | PodFehlt pending, ReplikatTot firing |
| 01:59:07 | 1/1 Running, 112 s |
0 | none |
Why does QdrantPodFehlt jump back from
firing to pending even though the pod is not
ready yet?
# on vdb1
kubectl -n qdrant get pods -o wideExpected (truncated on the right):
NAME READY STATUS RESTARTS AGE IP NODE
qdrant-0 1/1 Running 0 73m 10.42.1.56 vdb2
qdrant-1 1/1 Running 0 2m44s 10.42.3.6 vdb4
qdrant-2 1/1 Running 0 75m 10.42.2.16 vdb3
qdrant-1 has a new IP, 10.42.3.6 instead of
10.42.3.32. For Prometheus this is a new target and thus a
new time series up – and for the alerting rule a new alert
that starts at pending again. The old target has
disappeared, and its alert with it. The history confirms this:
# on vdb1
curl -sS http://10.43.23.41:9090/api/v1/query_range --data-urlencode 'query=ALERTS{alertname=~"Qdrant.*"}' --data-urlencode start=2026-12-06T01:49:00Z --data-urlencode end=2026-12-06T02:01:00Z --data-urlencode step=15s | jq -r '.data.result[] | .metric.alertname + " " + (.metric.instance // "-") + " " + .metric.alertstate + " " + (.values[0][0]|todate) + " bis " + (.values[-1][0]|todate)'Expected:
QdrantPodFehlt 10.42.3.32:6333 firing 2026-12-06T01:52:00Z bis 2026-12-06T01:57:45Z
QdrantPodFehlt 10.42.3.32:6333 pending 2026-12-06T01:51:00Z bis 2026-12-06T01:51:45Z
QdrantPodFehlt 10.42.3.6:6333 pending 2026-12-06T01:58:00Z bis 2026-12-06T01:58:45Z
QdrantReplikatTot - firing 2026-12-06T01:56:30Z bis 2026-12-06T01:58:45Z
QdrantReplikatTot - pending 2026-12-06T01:55:30Z bis 2026-12-06T01:56:15Z
The new target was down for just under a minute – Qdrant
was starting, and the gatekeeper from Day 10 approves new pods only
after a few seconds. Because that was shorter than for: 1m,
it never fired. The dead copy had caught up again by 01:58:45, and both
alerts were off.
Step 8 – check and delete the test points. What became of the two points with a timeout?
# on vdb1
curl -sS --cacert ../tag10/ca.crt -H "api-key: $(cat ../tag10/admin-key)" -H 'Content-Type: application/json' -d '{"ids":[911000,911001,911002,911003]}' https://10.43.151.237:6333/collections/verteilt/points | jq -c '[.result[].id]'Expected:
[911000,911001,911002,911003]
All four are there – including those with a timeout. As on Day 7: a timeout means “result unknown”, not “not written”. Now you clean up.
# on vdb1
curl -sS -X POST --cacert ../tag10/ca.crt -H "api-key: $(cat ../tag10/admin-key)" -H 'Content-Type: application/json' -d '{"points":[911000,911001,911002,911003]}' 'https://10.43.151.237:6333/collections/verteilt/points/delete?wait=true'Expected:
{"result":{"operation_id":98,"status":"completed"},"status":"ok","time":0.236305477}
# on vdb1
curl -sS -X POST --cacert ../tag10/ca.crt -H "api-key: $(cat ../tag10/lese-key)" -H 'Content-Type: application/json' -d '{"exact":true}' https://10.43.151.237:6333/collections/verteilt/points/countExpected:
{"result":{"count":13220},"status":"ok","time":0.01148376}
Back to 13,220 points.
Remember: A node failure triggers a dozen default alerts that only wake someone after 15 minutes. The database needs its own fast alerts for what really matters: a missing pod and a dead copy.
Save your progress? Sign up for free
Diagnosis task: The curve stays empty
The symptom: A colleague builds a panel “searches
per second, as current as possible” and writes rate(…[15s])
so that the curve reacts quickly. The panel stays empty even though
searches are running. With [1m] it works. Can you find the
reason before you read on?
Step 1 – generate load. 8 readers, 20,000 requests, about one minute:
# on vdb1 – Terminal 1
~/werkbank/bin/python last-prozesse.py https://10.43.151.237:6333 doku ../tag01/fragen.npy 8 20000Step 2 – the same question with three windows. After about 40 seconds, in the second terminal:
# on vdb1 – Terminal 2
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query=sum(rate(rest_responses_total{exported_endpoint=~".*/points/query"}[15s]))' | jq -c '.data.result'Expected:
[]
# on vdb1 – Terminal 2
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query=sum(rate(rest_responses_total{exported_endpoint=~".*/points/query"}[30s]))' | jq -c '.data.result'Expected:
[{"metric":{},"value":[1796522459.998,"378.8"]}]
# on vdb1 – Terminal 2
curl -sS http://10.43.23.41:9090/api/v1/query --data-urlencode 'query=sum(rate(rest_responses_total{exported_endpoint=~".*/points/query"}[1m]))' | jq -c '.data.result'Expected:
[{"metric":{},"value":[1796522460.043,"278.1944522222222"]}]
Solution: rate needs at least
two data points in the window to calculate a slope. The
messenger comes every 15 seconds; a 15-second window usually contains
only one. With 30 seconds there are two – that works, but a single
missed visit is enough and the curve has a gap. With one minute there
are four points in the window; in return the curve reacts more
sluggishly: 278 instead of 379 per second, because seconds without load
are still in the window.
Rule of thumb: the window is at least four times as long as the
scrape interval. Grafana offers the variable
$__rate_interval for this, which calculates the window from
the data source’s interval.
Remember:
rateover a window shorter than two visits returns nothing. Four visits per window are the safe choice.
Checkpoint
# on vdb1
kubectl -n monitoring get podsExpected: all pods Running. The
node-exporter on vdb4 has one restart from the outage in Drill 8.
NAME READY STATUS RESTARTS AGE
alertmanager-monitoring-kube-prometheus-alertmanager-0 2/2 Running 0 58m
monitoring-grafana-6c9c57c75b-lgxtc 3/3 Running 0 58m
monitoring-kube-prometheus-operator-7ccdcb47cf-rg55v 1/1 Running 0 58m
monitoring-kube-state-metrics-596b6bb859-x5jtr 1/1 Running 0 58m
monitoring-prometheus-node-exporter-4dt4m 1/1 Running 1 (4m47s ago) 58m
monitoring-prometheus-node-exporter-pf52f 1/1 Running 0 58m
monitoring-prometheus-node-exporter-tbsq7 1/1 Running 0 58m
monitoring-prometheus-node-exporter-vh27b 1/1 Running 0 58m
prometheus-monitoring-kube-prometheus-prometheus-0 2/2 Running 0 58m
# on vdb1
kubectl top pods -n monitoringExpected (your values will differ):
NAME CPU(cores) MEMORY(bytes)
alertmanager-monitoring-kube-prometheus-alertmanager-0 4m 41Mi
monitoring-grafana-6c9c57c75b-lgxtc 86m 449Mi
monitoring-kube-prometheus-operator-7ccdcb47cf-rg55v 13m 25Mi
monitoring-kube-state-metrics-596b6bb859-x5jtr 9m 21Mi
monitoring-prometheus-node-exporter-4dt4m 9m 8Mi
monitoring-prometheus-node-exporter-pf52f 13m 9Mi
monitoring-prometheus-node-exporter-tbsq7 8m 9Mi
monitoring-prometheus-node-exporter-vh27b 11m 10Mi
prometheus-monitoring-kube-prometheus-prometheus-0 202m 840Mi
After one hour, Prometheus needs 840 MiB, Grafana 449 MiB – together about 1.4 GiB on vdb1.
# on vdb1
curl -sS http://10.43.23.41:9090/api/v1/targets -o ziele.jsonThe same count as in Drill 2, this time entirely in jq:
group_by(.labels.job) forms groups per job,
length counts them, map(.health) | unique
shows the states in the group.
# on vdb1
jq -r '.data.activeTargets | group_by(.labels.job)[] | "\(length) \(.[0].labels.job) \(map(.health) | unique | join(","))"' ziele.jsonExpected:
1 apiserver up
1 coredns up
1 kube-state-metrics up
12 kubelet up
1 monitoring-grafana up
2 monitoring-kube-prometheus-alertmanager up
1 monitoring-kube-prometheus-operator up
2 monitoring-kube-prometheus-prometheus up
4 node-exporter up
3 qdrant-headless up
# on vdb1
curl -sS http://10.43.23.41:9090/api/v1/alerts | jq -r '.data.alerts[] | [.labels.alertname, .state] | @tsv'Expected:
Watchdog firing
Only the watchdog – all quiet.
# on vdb1
kubectl -n qdrant get pods -o wideExpected: three pods 1/1 Running as at
the end of Drill 8.
# on vdb1
kubectl -n longhorn-system get volumes.longhorn.io -o custom-columns=NAME:.metadata.name,STATE:.status.state,ROBUST:.status.robustnessExpected: all volumes attached and
healthy.
Test yourself
- A target is
downwith “invalid header field value for”Authorization”“. What is broken, and why does the same key work withcurl -H "api-key: $(cat …)"? - Why do your queries say
exported_endpointinstead ofendpoint? - A query for the error rate returns
[]. Is the error rate 0? - The load generator reports p99 67 ms, Prometheus 49 ms. Which number is right?
- After an overload ends,
QdrantSucheZuLangsamkeeps firing for five more minutes. A bug in the rule? - A node fails, and Prometheus lists 19 alerts, but only two arrive at Alertmanager. Why?
Answers:
- The key in the Secret ends with a line break, and Prometheus puts
the value literally into the header – a line break is forbidden there.
With
$(cat …)the shell cuts off the final line break, socurldoes not notice. Fix: a Secret without the line break (tr -d "\n"). - The Prometheus Operator attaches a label
endpointwith the port name (http) to every time series. Qdrant supplies its ownendpoint; in the collision, Prometheus renames the application’s label toexported_endpoint. - Not necessarily.
[]means there is no matching time series – here because no 5xx response ever came. It can also be a wrong label name. Withor vector(0), “nothing” becomes a real 0. - Both; they measure different things. Prometheus measures the time in the Qdrant server, the load generator the time at the client including Python, TLS and network. An SLO on server metrics says nothing about the reader’s waiting time.
- No. After the end, the
[5m]window still contains five minutes of rush, and without new searches the share does not change. Only when the window is empty does it becomeNaN, and the alert ends. - Most default rules have
for: 15mand staypendingthat long; only alerts in thefiringstate reach Alertmanager. Your Qdrant rules havefor: 1m.
Interview note
“How do you monitor a vector database on Kubernetes?” – With
kube-prometheus-stack and a ServiceMonitor that queries each pod
individually, because each pod only knows its own requests and shards.
With Qdrant using a key and TLS, that means: a Secret without a line
break for the bearer header, the CA and a serverName,
because pod IPs are not in the certificate. As the SLI I take the share
of searches under a bucket boundary of the histogram, not an estimated
p99 – for example 99% under 50 ms. I set alerts on the burn rate of the
error budget, plus fast alerts for a missing pod and for
collection_dead_replicas, because the default rules wait 15
minutes. And I know that a latency alert stays silent at zero traffic:
without searches there is no SLI.
Enterprise note
In production, Prometheus gets a PersistentVolume and usually
long-term storage (Thanos, Mimir or VictoriaMetrics), Alertmanager runs
with several replicas and sends to a pager service – with routes by
severity, silences for maintenance windows and an external
“dead man’s switch” that raises the alarm when the Watchdog
stops arriving. Grafana belongs behind a login (OIDC) without anonymous
access.
SLO alerts use several windows: a fast alert fires when the burn rate over one hour and over five minutes are both above 14.4 (2% of the monthly budget in one hour), a slow one at a rate of 6 over six hours. This way short spikes wake nobody, and a steady leak is still noticed. Tools like Sloth or Pyrra generate these rules from an SLO description.
The reader’s view is measured at the client: applications export their own histograms or traces (OpenTelemetry). A synthetic prober that regularly sends a known search provides an SLI even when there is no real traffic – exactly the gap from Drill 7. And high-cardinality labels (collection names per tenant, user IDs) do not belong in metrics: every combination is a separate time series, and Prometheus’s storage grows with them.
Summary
last-prozesse.pywith read-only key, CA andcheck_compatibility=False: 505 requests/s with 16 readers, 0 errors./metricsof one pod: 227 lines. Qdrant only counts operationally relevant endpoints, time series only come into existence with the first request,collection_pointscounts only the shards on this pod. Histogram buckets at 1, 5, 10, 20, 50, 100, 500 ms.- kube-prometheus-stack 94.5.0 on vdb1, Grafana 13.3.2 with its own
password Secret, k3s components switched off. The chart notes name a
Secret that does not exist with
existingSecret. - ServiceMonitor: first “invalid header field value” (line break in
the key), then x509 (pod IP not in the certificate); with a separate
Secret and
serverName: qdrant.qdrant.svcall three targetsup. New configuration takes effect only after one to two minutes. - Prometheus renames Qdrant’s
endpointtoexported_endpoint. Server p99 49 ms versus client p99 67 ms; distribution by connections, not by requests. - SLO 99% under 50 ms; recording rules for rate, share slow, error
share (
or vector(0)); four alerts. - Overload with 48 readers: 19% slow searches,
pendingafter 30 s,firingafter another 2 min, 0 errors. After the end of the load stillfiringfor 4:40 min, thenNaN. - Node failure vdb4: 19 alerts, only
QdrantPodFehltfiringafter 1 min; two Dead copies after writing,QdrantReplikatTot. After the restart, new pod IP = new alert; everything resolved after 1:45 min, all test points written despite the timeout. rate(…[15s])with a 15 s scrape interval is empty: at least two, better four data points per window.
Commands at a glance
| Command | Purpose |
|---|---|
curl --resolve <name>:6333:<pod-ip> --cacert ca.crt -H "api-key: …" https://<name>:6333/metrics |
metrics of exactly one pod with TLS |
grep "^rest_responses_duration_seconds" <file> |
find histogram lines |
helm install monitoring oci://ghcr.io/prometheus-community/charts/kube-prometheus-stack --version 94.5.0 -n monitoring -f <values> |
install monitoring |
curl http://<prometheus>:9090/api/v1/targets -o ziele.json |
all targets with state and lastError |
jq '.data.activeTargets[] \| select(…) \| [.labels.pod, .health, .lastError]' ziele.json |
filter targets |
wc -c <file> |
count characters – reveals a line break |
tr -d "\n" < <in> > <out> |
remove line breaks |
curl …/api/v1/query --data-urlencode 'query=<promql>' |
PromQL at the current point in time |
curl …/api/v1/query_range --data-urlencode 'query=…' --data-urlencode start=… --data-urlencode end=… --data-urlencode step=… |
PromQL over a time range |
sum by (pod) (rate(<counter>[1m])) |
rate per pod |
histogram_quantile(0.99, sum by (le) (rate(<histogram>_bucket[1m]))) |
p99 from a histogram |
(sum(rate(…{status=~"5.."}[5m])) or vector(0)) / sum(rate(…[5m])) |
error rate, a number even without errors |
ALERTS{alertname="…"} |
history of an alert |
curl …/api/v1/rules -o regeln.json |
loaded rules and their state |
curl …/api/v1/alerts |
alerts in Prometheus (pending and firing) |
curl http://<alertmanager>:9093/api/v2/alerts /
…/api/v2/alerts/groups |
alerts and groups at Alertmanager |
curl 'http://<grafana>/api/search?query=…' |
search dashboards |
ssh -N -L 3000:<grafana-ip>:80 ubuntu@<vdb1> |
open Grafana from your own computer |