Description
Thanos, Prometheus and Golang version used:
image: bitnami/thanos:0.36.1-debian-12-r3
thanos helm chart: thanos-15.8.0
Object Storage Provider:
Azure Storage Account
What happened:
Prometheus operator deploys prometheus instances.
Each prometheus instance has own set of prometheusrules for alerting and use thanos sidecar.
Prometheus rules are correctly inserted to thanos via thanos sidecar.
Thanos query responds with all prometheus rules for all prometheus instances.
1, Thanos query is defined for multi-tenancy:
query:
extraFlags:
- --query.replica-label=replica
- --query.enforce-tenancy
- --query.tenant-header=THANOS-TENANT
- --query.tenant-label-name=tenant
- Each prometheus instance has thanos sidecar:
thanos:
objectStorageConfig:
existingSecret:
name: thanos-object-shared-storage-account
key: objstore.yml
...
externalLabels:
env: dev
tenant: tenant2
Prometheus rules are correctly seen on thanos UI:
alert:AlertmanagerClusterCrashlooping
expr:(count by (namespace, service, cluster) (changes(process_start_time_seconds{job="prometheus-tenant2- prom-te-alertmanager",namespace="tenant2"}[10m]) > 4) / count by (namespace, service, cluster) (up{job="prometheus-tenant2-prom-te-alertmanager",namespace="tenant2"})) >= 0.5
for: 5m
labels:
cluster: abc
env: dev
severity: critical
tenant: tenant2 # each instance has different tenant value
- Grafana datasource is defined to use header:
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDatasource
metadata:
name: thanos
namespace: tenant2
spec:
instanceSelector:
matchLabels:
dashboards: "tenant2"
allowCrossNamespaceImport: false
datasource:
name: "Global - Prometheus"
type: prometheus
access: proxy
uid: "global-prometheus"
url: http://thanos-query-frontend.thanos.svc.cluster.local:9090
isDefault: true
jsonData:
httpHeaderName1: 'THANOS-TENANT'
secureJsonData:
httpHeaderValue1: 'tenant2'
Grafana query alert rules like is like curl command:
curl -H 'THANOS-TENANT: tenant2' http://thanos-query-frontend.thanos.svc.cluster.local:9090/api/v1/rules
- Output is that all prometheus rules are responded regardless if it is tenant2 or different value.
What you expected to happen:
Thanos query should respond with prometheusrules with specific label
How to reproduce it (as minimally and precisely as possible):
- configure thanos with mulitenancy
- configure two different prometheus instances using different external labels and thanos sidecar
- insert different prometheusrules to each prometheus instance
- see thanos rules on UI
- see thanos query response via curl or via grafana datasource using tenant header
Full logs to relevant components:
Can deliver if required
Anything else we need to know:
Run on K8S 1.32