接下来,我们需要在Kubernetes Service中添加注解prometheus.io/scrape,并将其值设置为true,以告诉Prometheus需要对该服务进行监控。 示例代码: apiVersion:v1kind:Servicemetadata:name:my-serviceannotations:prometheus.io/scrape:"true"prometheus.io/path:"/metrics"prometheus.io/port:"8080"spec:... 1. 2. 3. ...
prometheus.io/scrape: "true" prometheus.io/port: "9101" spec: containers: - name: my-app image: registry.cn-hangzhou.aliyuncs.com/containerdemo/containersol-k8s-deployment-strategies ports: - name: http containerPort: 8080 - name: probe containerPort: 8086 env: - name: VERSION value: v1.0...