Signed-off-by: Artem Navoiev <tenmozes@gmail.com>
2.4 KiB
sort | weight | title | menu | ||||||
---|---|---|---|---|---|---|---|---|---|
8 | 8 | VMPodScrape |
|
VMPodScrape
The VMPodScrape
CRD allows to declaratively define how a dynamic set of pods should be monitored.
Use label selections to match pods for scraping. This allows an organization to introduce conventions
for how metrics should be exposed. Following these conventions new services will be discovered automatically without
need to reconfigure.
VMPodScrape
object generates part of VMAgent configuration with
kubernetes service discovery role pod
having specific labels and ports.
It has various options for scraping configuration of target (with basic auth,tls access, by specific port name etc.).
A Pod
is a collection of one or more containers which can expose Prometheus metrics on a number of ports.
The VMPodScrape
object discovers pods and generates the relevant scraping configuration.
The PodMetricsEndpoints
section of the VMPodScrapeSpec
is used to configure which ports of a pod are going to be
scraped for metrics and with which parameters.
Both VMPodScrapes
and discovered targets may belong to any namespace. It is important for cross-namespace monitoring
use cases, e.g. for meta-monitoring. Using the namespaceSelector
of the VMPodScrapeSpec
one can restrict the
namespaces from which Pods
are discovered from. To discover targets in all namespaces the namespaceSelector
has to
be empty:
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMPodScrape
metadata:
name: example-pod-scrape
spec:
namespaceSelector:
any: true
More information about selectors you can find in this doc.
Specification
You can see the full actual specification of the VMPodScrape
resource in
the API docs -> VMPodScrape.
Also, you can check out the examples section.
Migration from Prometheus
The VMPodScrape
CRD from VictoriaMetrics Operator is a drop-in replacement
for the Prometheus PodMonitor
from prometheus-operator.
More details about migration from prometheus-operator you can read in this doc.
Examples
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMPodScrape
metadata:
name: example-pod-scrape
spec:
podMetricsEndpoints:
- port: web
scheme: http
selector:
matchLabels:
owner: dev