Prometheus Operator Concepts: Difference between revisions
Jump to navigation
Jump to search
Line 7: | Line 7: | ||
=Custom Resources= | =Custom Resources= | ||
==Prometheus Resource== | ==<span id='Prometheus'></span>Prometheus Resource== | ||
The Prometheus resource declares a "serviceMonitorSelector": | The Prometheus resource declares a "serviceMonitorSelector": | ||
<syntaxhighlight lang='yaml'> | <syntaxhighlight lang='yaml'> | ||
Line 19: | Line 19: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==ServiceMonitor Resource== | ==<span id='ServiceMonitor'></span>ServiceMonitor Resource== | ||
A ServiceMonitor is a custom resource | A ServiceMonitor is a custom resource | ||
Revision as of 22:30, 14 October 2020
Internal
Overview
The Operator decouples the deployment of Prometheus instances from the configuration of which targets they are monitoring. The Operator defines two custom resources: Prometheus and ServiceMonitor.
Custom Resources
Prometheus Resource
The Prometheus resource declares a "serviceMonitorSelector":
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
...
spec:
serviceMonitorSelector:
matchLabels:
release: prometheus
ServiceMonitor Resource
A ServiceMonitor is a custom resource
The labels are important, they must match Prometheus serviceMonitorSelector.
The current service monitor list can be obtained with:
kubectl -n <namespace> get servicemonitors