简体   繁体   English

如何在普罗米修斯 kubernetes 中设置目标?

[英]How to set targets in prometheus kubernetes?

I am trying to setup Prometheus for my Kubernetes cluster.我正在尝试为我的 Kubernetes 集群设置 Prometheus。 I am using https://github.com/coreos/kube-prometheus .我正在使用https://github.com/coreos/kube-prometheus I am using default namespace only.我只使用default命名空间。 When I apply resources from manifests (https://github.com/coreos/kube-prometheus/tree/master/manifests ) folder, It creates resources but in targets, it doesn't show my pod service.当我从manifestshttps://github.com/coreos/kube-prometheus/tree/master/manifests )文件夹应用资源时,它会创建资源但在目标中,它不会显示我的 pod 服务。

I am new to Kubernetes so I need help with this.我是 Kubernetes 的新手,所以我需要帮助。 How do I configure my pod to show up in Prometheus targets?如何配置我的 pod 以显示在 Prometheus 目标中? I tried https://github.com/coreos/kube-prometheus#quickstart我试过https://github.com/coreos/kube-prometheus#quickstart

For better manageability use Prometheus Operator .为了更好的可管理性,请使用Prometheus Operator

You need to define ServiceMonitor or PodMonitor您需要定义ServiceMonitorPodMonitor

ServiceMonitor which declaratively specifies how groups of services should be monitored. ServiceMonitor以声明方式指定应如何监视服务组。 The Operator automatically generates Prometheus scrape configuration based on the definition and the targets will have the IPs of all the pods behind the service. Operator 根据定义自动生成 Prometheus 抓取配置,目标将拥有服务背后所有 Pod 的 IP。

PodMonitor , which declaratively specifies how groups of pods should be monitored. PodMonitor ,它以声明方式指定应如何监视 pod 组。 The Operator automatically generates Prometheus scrape configuration based on the definition and targets will have the Pod IP Operator 根据定义自动生成 Prometheus 抓取配置,目标将具有 Pod IP

Refer to the examples here请参阅此处的示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM