How to configure my k8s prometheus operator to scrape a target who's IP depends on the pod deployment

8/20/2020

I'm looking to add my own custom prometheus exporter as a scrape target for my prometheus operator thats running on my k8s cluster. I've written a prometheus resource yaml to configure prometheus, but can't decide what to put for target.

global:
  scrape_interval:     15s
  evaluation_interval: 15s

rule_files:
  # - "first.rules"
  # - "second.rules"

scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ['localhost:9090']
  - job_name: my-custom-node-exporter
    static_configs:
      - targets: ['????:8080']

does this not work for prometheus operators?

-- Trevor Jordy
kubernetes
prometheus
prometheus-operator

0 Answers