问题描述
似乎我既无法通过注释方法也无法通过 prometheus
刮除我的目标,也无法通过 ServiceMonitor
解决方法.
It seems that I can't get my target scraped by prometheus
neither via the annotation method nor the ServiceMonitor
workaround.
这是我的 Service
对象的 spec
说明,该指标公开了指标
Here is the spec
scetion of my Service
Object exposing the metrics
spec:
clusterIP: 10.107.228.89
ports:
- name: metricsport
port: 8282
protocol: TCP
targetPort: 8282
selector:
app: my-app
release: my-app
sessionAffinity: None
type: ClusterIP
此做公开指标,我通过集群中的另一个Pod通过 curl
对其进行了验证
This DOES expose metrics, which I verify by curl
ing it via another pod from within the cluster
curl http://my-service-metrics:8282/metrics
(...a lot of metrics)
这是我的 ServiceMonitor
spec
spec:
endpoints:
- path: /metrics
port: metricsport
namespaceSelector:
matchNames:
- default
selector:
matchLabels:
app: my-app
release: my-app
我该怎么办/尝试使我的指标被 prometheus
刮掉?
What else should I do/try to get my metrics being scraped by prometheus
?
(目标未出现在我的 http://prometheus/targets
中)
(the target does not appear in my http://prometheus/targets
)
推荐答案
在Slack中得到解答后,需要确保ServiceMonitor对象本身的标签与Prometheus对象上的 serviceMonitorSelector
匹配.
Answered in Slack, need to make sure the labels on the ServiceMonitor object itself match the serviceMonitorSelector
on the Prometheus object.
这篇关于目标不会被普罗米修斯刮擦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!