Merged
Conversation
…at/improve-monitoring
sfdamm
approved these changes
Jul 20, 2025
Collaborator
sfdamm
left a comment
There was a problem hiding this comment.
awesome monitoring dashboards, and automatically discovery. (just added some network changes, and ci/cd pipeline updates).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds documentation and configuration examples for how the Prometheus Operator discovers monitoring targets using ServiceMonitors and Probes in a Kubernetes environment.
Prometheus Operator ServiceMonitor Discovery
The Prometheus Operator manages Prometheus instances using a Kubernetes Custom Resource (CR) called Prometheus.
ServiceMonitors are custom resources that define how Prometheus should discover and scrape metrics endpoints from Kubernetes Services.
The Operator automatically watches for ServiceMonitors in specified namespaces (or all namespaces, if configured).
Discovery process:
The Operator reads the serviceMonitorSelector and serviceMonitorNamespaceSelector fields in the Prometheus CR.
It finds all ServiceMonitors matching the selectors.
For each ServiceMonitor, it matches the selector.matchLabels to Services in the target namespace(s).
For each matching Service, it scrapes the specified port and path (e.g., /metrics or /actuator/prometheus).
Benefits:
Dynamic, label-based discovery of services to monitor.
No need to manually edit Prometheus config for new services.
Supports multi-namespace and multi-team setups.
Prometheus Operator Probe Discovery
Probes are custom resources (if enabled) that define blackbox monitoring checks (e.g., HTTP, TCP, ICMP) using the blackbox exporter.
The Operator watches for Probe resources using probeSelector and probeNamespaceSelector in the Prometheus CR.
Discovery process:
The Operator finds all Probe resources matching the selectors.
For each Probe, it configures Prometheus to scrape the blackbox exporter with the specified module and target(s).
Probes are ideal for monitoring external endpoints, APIs, or HTTP health of services (including databases or exporters).
Benefits:
Enables synthetic monitoring (probes) alongside service scraping.
Centralizes all monitoring configuration in Kubernetes resources.
Key Features Enabled by This PR
Automatic discovery of all ServiceMonitors and Probes in the cluster (with {} selectors).
No need for static scrape configs—all targets are managed via Kubernetes resources.
Supports both application metrics (via ServiceMonitors) and endpoint health checks (via Probes).
RBAC configuration ensures Prometheus can discover targets across namespaces.