Prometheus CR规范中的servicemonitor发现(标签选择器和命名空间选择器) &



谁能给我解释一下什么是逻辑,或者我应该如何处理下面的问题?我有普罗米修斯CRServiceMonitor选择器.

Name:         k8s
Namespace:    monitoring
Labels:       prometheus=k8s
Annotations:  <none>
API Version:  monitoring.coreos.com/v1
Kind:         Prometheus
...
Service Monitor Namespace Selector:
Service Monitor Selector:
...

Prometheus能够发现它创建的所有servicemonitor,但它不能发现我的(新创建的)。上面的代码是否应该匹配所有内容,或者您知道如何实现这一点(即匹配每个单个ServiceMonitor) ?

示例

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: example-app
namespace: monitoring
labels:
# release: prometheus
# team: frontend
spec:
selector:
matchLabels:
app: example-app
namespaceSelector:
# matchNames:
# - default
matchNames:
- e
endpoints:
- port: web

其余详细信息

我知道我可以用这样的东西来发现它,但这需要在所有其他监视器中进行更改。

serviceMonitorSelector:
matchLabels:
team: frontend

我不想使用helm安装普罗米修斯操作符,所以我从https://github.com/prometheus-operator/kube-prometheus#warning安装了它。

如果你只想发现所有prometheus和prometheus操作符可以通过各自的RBAC访问给定集群上的servicemonitor,您可以像这样使用和空选择器:

serviceMonitorNamespaceSelector: {}
serviceMonitorSelector: {}

最新更新