【发布时间】:2020-10-27 07:13:43
【问题描述】:
我的 service 和 servicemonitor 定义如下,
kind: Service
apiVersion: v1
metadata:
name: example-application
labels:
app: example-application
teamname: neon
spec:
selector:
app: example-application
ports:
- name: backend
port: 8080
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: example-application
namespace: monitoring
spec:
selector:
matchLabels:
app: example-application
endpoints:
- port: backend
path: /prometheus
namespaceSelector:
matchNames:
- testns
targetLabels:
- teamname
Pods 都可用。我已经测试了服务。
但目标在 Prometheus 中显示为 DOWN。请让我知道我缺少什么。
【问题讨论】:
-
确保您指定了正确的路径,
/prometheus? -
@KamolHasan ...感谢您的回复...我需要在哪里定义这条路径吗?我只是在服务监视器中提到了这个路径,如上面的代码所示。如果有什么地方我需要添加这个路径,请告诉我。
-
你可以使用github.com/txn2/kubefwd 转发并尝试
curl http://example-application.testns:8080/prometheus吗?