【发布时间】:2021-02-04 19:14:34
【问题描述】:
我正在使用this prometheus chart。在文档中它说
为了让 prometheus 抓取 pod,您必须为 pod 添加注释,如下所示:
metadata: annotations: prometheus.io/scrape: "true" prometheus.io/path: /metrics prometheus.io/port: "8080"
所以我创建了这样的服务
apiVersion: v1
kind: Service
metadata:
name: nodejs-client-service
labels:
app: nodejs-client-app
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: /metrics
prometheus.io/port: "5000"
spec:
type: LoadBalancer
selector:
app: nodejs-client-app
ports:
- protocol: TCP
name: http
port: 80
targetPort: 5000
但我的服务不会出现在普罗米修斯目标中。我错过了什么?
【问题讨论】:
-
...向 pod 中添加注释...通过这句话,我不明白,注释必须放在 pod 中而不是服务中。您是否尝试过在部署规范或类似的情况下将注释添加到您的 pod?
-
是的,我已经尝试在我的部署文件中的
metadata/annotations和spec/template/metadata/annotations下添加注释,但都不起作用 -
您是否设法解决了这个问题?我有同样的issue
标签: kubernetes prometheus kubernetes-helm