我已经将kube状态度量部署到kube-system命名空间中,在同一个集群中,我们让prometheus -运算符运行,我编写了下面的服务监视器文件,用于向prometheus发送度量,但它不起作用。请找到下面的文件。
Servicemonitor.yaml
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: kube-state-metrics
labels:
app.kubernetes.io/name: kube-state-metrics
namespace: kube-system
spec:
selector:
matchLabels:
prometheus-scrape: "true"
endpoints:
- port: metrics
path: /metrics
targetPort: 8080
honorLabels: true
scheme: https
tlsConfig:
insecureSkipVerify: truePrometheus-deploy.yaml
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
annotations:
argocd.argoproj.io/sync-wave: "1"
name: prometheus
labels:
name: prometheus
spec:
serviceAccountName: prometheus
serviceMonitorSelector: {}
serviceMonitorNamespaceSelector:
matchLabels:
prometheus-scrape: "true"
podMonitorSelector: {}
podMonitorNamespaceSelector:
matchLabels:
prometheus-scrape: "true"
resources:
requests:
memory: 400Mi
enableAdminAPI: false
additionalScrapeConfigs:
name: additional-scrape-configs
key: prometheus-additional.yaml有谁能帮我解决这个问题吗?
谢谢。
发布于 2022-06-21 06:34:19
ServiceMonitor的selector>matchLabels应该与“服务”的标签匹配。检查您的服务是否有正确的标签。
https://stackoverflow.com/questions/72662566
复制相似问题