A new ServiceMonitor is not picked up by the Prometheus Operator
IntermediateTroubleshootingKubernetes monitoring and the Prometheus Operator
Answer
Likely causes → The ServiceMonitor lacks the label matching serviceMonitorSelector (kube-prometheus-stack: release: <helm-release>), its namespace is not in serviceMonitorNamespaceSelector, or the CRD version differs.
Diagnose →
kubectl get prometheus -n monitoring -o jsonpath='{.items[0].spec.serviceMonitorSelector}{"\n"}{.items[0].spec.serviceMonitorNamespaceSelector}'
kubectl get servicemonitor -n shop checkout -o yaml | grep -A3 labels
Fix → Add the label (e.g. release: kube-prometheus-stack), or set the Helm values serviceMonitorSelectorNilUsesHelmValues: false so all ServiceMonitors are selected.
Prevent → Provide a ServiceMonitor template with the right labels to app teams.
More on Kubernetes monitoring and the Prometheus Operator
ServiceMonitor is selected but its targets don't appear on `/targets`IntermediateServiceMonitor target appears but Operator logs `skipping servicemonitor ... failed to get secret`AdvancedPodMonitor targets show `DOWN` with `connection refused` on port 8080 while the app listens on 9090BeginnerPrometheusRule created but rules don't show in PrometheusIntermediate`KubeletDown` / `TargetDown` alerts fire for kube-scheduler and kube-controller-manager on EKS/GKEBeginnerOn kubeadm clusters, `kube-controller-manager` and `kube-scheduler` targets are `DOWN` with `connection refused`Intermediate