我有如下定义的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: 8080apiVersion: 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:
- teamnamePod全部可用,我已经测试过了。
但是目标在Prometheus.Please中显示为DOWN,让我知道我错过了什么。

发布于 2020-10-28 03:42:11
我找到了缺失的部分。我必须在该路径上公开应用程序中的指标。
出于示例目的,我使用本文中给出的相同图像作为deployment对象中指标的侧车容器,如下所示:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: example-application
spec:
replicas: 4
template:
metadata:
labels:
app: example-application
spec:
containers:
- name: example-application
image: nginx
ports:
- name: backend
containerPort: 80
- name: rpc-app-cont
image: supergiantkir/prometheus-test-app
ports:
- name: web
containerPort: 8081然后将这个端口"web“添加到服务监视器。
现在它工作得很好..

https://stackoverflow.com/questions/64549690
复制相似问题