ServiceMonitor or PodMonitor resources. The Metoro Helm chart installs and configures an OpenTelemetry Collector and Target Allocator for this purpose. You do not need to run another collector or configure Prometheus remote write.
The Target Allocator discovers monitor resources and distributes their scrape targets across the Metoro-managed collector replicas. The collectors scrape the targets and send the metrics through the in-cluster Metoro exporter.
The Target Allocator assigns targets; it does not scrape or forward metrics itself.
Prerequisites
- Metoro is installed with the Metoro exporter Helm chart.
- The
ServiceMonitorandPodMonitorcustom resource definitions (CRDs) are installed in the cluster. - Your workload exposes a Prometheus-compatible metrics endpoint that is reachable from the Metoro namespace.
monitoring.coreos.com CRDs. If you use kube-prometheus-stack or the Prometheus Operator, you likely already have the CRDs. You do not need a running Prometheus server for Metoro to use them.
Check for the CRDs:
Verify the Metoro scraper is running
The chart creates a collector StatefulSet and a Target Allocator Deployment. If Metoro is installed in themetoro namespace, check them with:
Create a ServiceMonitor
The following example assumes that an application namedexample-api exposes Prometheus metrics on port 8080 at /metrics.
First, make sure the application has a Kubernetes Service with a named port:
ServiceMonitor that selects the Service:
ServiceMonitor.spec.selectormatches labels on the Service, not labels on its Pods.ServiceMonitor.spec.endpoints[].portmatches the name of a Service port. In this example, both aremetrics.- Without
ServiceMonitor.spec.namespaceSelector, the ServiceMonitor finds Services only in its own namespace.
spec.namespaceSelector on the ServiceMonitor:
Verify target discovery
Allow about one minute for discovery and the first scrape. Then list the Target Allocator Service:up metric can also help confirm whether the endpoint is reachable; filter it by the ServiceMonitor job or instance labels.
Limit which monitors Metoro scrapes
By default, Metoro discovers all ServiceMonitor and PodMonitor resources in all namespaces. In a shared cluster, you can restrict discovery with Helm values. For example, label the monitor resources that Metoro should use:ServiceMonitor and PodMonitor objects themselves. They do not replace the selector inside each monitor that chooses Services or Pods.
You can also restrict the namespaces in which Metoro looks for monitor resources:
namespaceSelector to both ServiceMonitor and PodMonitor discovery. This is different from ServiceMonitor.spec.namespaceSelector, which selects namespaces containing the target Services.
Use a PodMonitor instead
Use aPodMonitor when there is no Kubernetes Service in front of the metrics endpoint. Its selector matches Pod labels, and its endpoint port matches a named container port:
Troubleshooting
The monitor does not appear in /jobs
-
Confirm that the resource exists:
kubectl get servicemonitor,podmonitor -A. -
Check that labels on the monitor match the Helm
serviceMonitorSelectororpodMonitorSelector. -
Check that the namespace containing the monitor matches the Helm
namespaceSelector. -
Inspect Target Allocator logs:
The monitor appears, but it has no targets
- Confirm that the monitor selector matches the Service or Pod labels.
- For a ServiceMonitor, confirm that the endpoint port matches the Service port name.
- For a PodMonitor, confirm that the endpoint port matches the container port name.
- Check the monitor’s
spec.namespaceSelectorand verify that the Service or Pod exists in a selected namespace. - Confirm that the Service has ready endpoints with
kubectl get endpointslices -n <namespace>.
Targets exist, but metrics do not appear in Metoro
-
Check NetworkPolicies, DNS, TLS, and authentication between the collector Pods in
metoroand the metrics endpoint. -
Inspect collector logs:
- Check whether the same targets are also being forwarded by another Prometheus or collector configuration, which can create duplicate series.
- Make sure the metric name is not reserved by Metoro.
