Skip to content

Simple PodMonitor

Back

This example show a basic configuration for PodMonitor.

spec:
  podMetricsEndpoints:
  - interval: 30s
    targetPort: 14269
  jobLabel: k8s-app
  selector:
    matchLabels:
      k8s-app: sample-service

It means that Prometheus/Victoriametrics will collect metrics from pods with settings:

  • metrics will collect with job with label k8s-app
  • metrics will collect from all pods with label k8s-app: sample-service
  • metrics will collect from all discovered pod from port 14269 with interval 30s

Files

How to apply example

Kubernetes:

kubectl apply -f pod-monitor.yaml

OpenShift:

oc apply -f pod-monitor.yaml

Prometheus operator API

Victoriametrics operator API