Interview Prep/SRE & Reliability/Prometheus SLIs & Recording Rules

Joining SLI series with `kube_pod_labels` to add a `team` label fails with `many-to-many matching not allowed: matching labels must be unique on one side`.

AdvancedTroubleshootingPrometheus SLIs & Recording Rules
Answer

Likely causes → Both sides have multiple series per matching key: kube_pod_labels can have duplicates (several kube-state-metrics replicas, or pods recreated with the same name), and the SLI side is not unique either.

Diagnose →

count by (namespace, pod) (kube_pod_labels) > 1

Fix → Make one side unique with aggregation and use group_left:

sum by (namespace, pod) (rate(http_requests_total[5m]))
* on (namespace, pod) group_left(label_team)
max by (namespace, pod, label_team) (kube_pod_labels)

Prevent → Prefer static team labels via ServiceMonitor relabeling or podTargetLabels instead of runtime joins in SLO rules.

All SRE & Reliability questions Roadmap: SRE & incident response

More on Prometheus SLIs & Recording Rules