Apply additional label to headless Service + ServiceMonitor to avoid duplicate scraping (#214)

Add a common label `app.kubernetes.io/component` ([1]) with value
`cluster-discovery` to the headless Service and the ServiceMonitor it's ensured
metrics are only scraped once.

Using the headless service also makes the most sense, as it has the sole purpose
of discovering all Pods making up a qdrant cluster.
With `publishNotReadyAddresses: true` metrics are also collected from non-ready
pods, see [2]. This is helpful to also collect metrics from Pods that might never
become ready to use them for e.g. alerting and problem analysis

[1] https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/#labels
[2] https://github.com/prometheus-operator/prometheus-operator/discussions/5693

Fixes: #207
This commit is contained in:
Christian Rohmann
2024-08-12 10:43:41 +02:00
committed by GitHub
parent 0d78af2b99
commit c9e613ae2e
2 changed files with 2 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ metadata:
name: {{ include "qdrant.fullname" . }}-headless
labels:
{{- include "qdrant.labels" . | nindent 4 }}
app.kubernetes.io/component: cluster-discovery
{{- with .Values.service.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}

View File

@@ -40,4 +40,5 @@ spec:
selector:
matchLabels:
{{- include "qdrant.labels" . | nindent 6 }}
app.kubernetes.io/component: cluster-discovery
{{- end }}