Thecoder
Thecoder

Reputation: 51

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

Upvotes: 2

Views: 3920

Answers (1)

Arghya Sadhu
Arghya Sadhu

Reputation: 44559

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

Upvotes: 5

Related Questions