简体   繁体   中英

How to set targets in prometheus kubernetes?

I am trying to setup Prometheus for my Kubernetes cluster. I am using https://github.com/coreos/kube-prometheus . I am using default namespace only. 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.

I am new to Kubernetes so I need help with this. How do I configure my pod to show up in Prometheus targets? I tried https://github.com/coreos/kube-prometheus#quickstart

For better manageability use Prometheus Operator .

You need to define ServiceMonitor or PodMonitor

ServiceMonitor which declaratively specifies how groups of services should be monitored. 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.

PodMonitor , which declaratively specifies how groups of pods should be monitored. The Operator automatically generates Prometheus scrape configuration based on the definition and targets will have the Pod IP

Refer to the examples here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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