Binary operation fails: `many-to-many matching not allowed: matching labels must be unique on one side`
AdvancedTroubleshootingPromQL and recording rules
Answer
Likely causes → Both sides have multiple series per match group, often when joining with kube_pod_info or kube_pod_labels which can have duplicates during pod restarts or from two kube-state-metrics replicas.
Diagnose →
count by (namespace, pod) (kube_pod_info) > 1
Fix → Aggregate the "one" side first and use explicit matching:
sum by (namespace, pod) (rate(container_cpu_usage_seconds_total[5m]))
* on (namespace, pod) group_left(node)
max by (namespace, pod, node) (kube_pod_info)
Prevent → Run one kube-state-metrics per cluster (or shard properly) and always wrap join sides in max by.
More on PromQL and recording rules
A PromQL query in the UI returns `Empty query result` for a metric you can see on `/metrics`Beginner`rate(http_requests_total[1m])` returns nothing but `http_requests_total` has dataBeginner`rate()` applied to a gauge shows huge spikesBeginner`found duplicate series for the match group {pod="api-1"} on the right hand-side of the operation`IntermediateError ratio query returns no data during quiet hoursIntermediate`histogram_quantile` returns `NaN`Intermediate