doubi1928 2017-08-25 22:06
浏览 231
已采纳

如何显示使用Golang客户端库从Kubernetes中运行的所有Pod中捕获的Prometheus中的自定义应用程序指标

I am trying to get some custom application metrics captured in golang using the prometheus client library to show up in Prometheus.

I have the following working:

apiVersion: v1
kind: Pod
metadata:
  name: my-app-pod
  labels:
    zone: prod
    version: v1
  annotations:
   prometheus.io/scrape: 'true'
   prometheus.io/port: '8080'

spec:
   containers:
    - name: my-container
      image: name/my-app:latest
      imagePullPolicy: IfNotPresent
      ports:
      - containerPort: 8080
  • If I connect to my pod using:

kubectl exec -it my-app-pod -- /bin/bash

then do wget on "localhost:8080/metrics", I can see my metrics

So far so good, here is where I am hitting a wall. I could have multiple pods running this same image. I want to expose all the images to prometheus as targets. How do I configure my pods so that they show up in prometheus so I can report on my custom metrics?

Thanks for any help offered!

  • 写回答

3条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥20 b站私信完整导出的方法
      • ¥15 边界图中的x、y轴解释
      • ¥30 如何用matlab求解复杂方程
      • ¥15 VUE TS中怎么调用第三方js
      • ¥15 Activiti如何将值传入textValue
      • ¥20 在linux里安装lummps时 在make mpi里找不到rpc
      • ¥25 python先到先得调度和轮询调度
      • ¥15 SDK Manager闪退
      • ¥15 intel i219v mac地址修改问题
      • ¥15 leetcode上面的题,求解