ServiceMonitor is selected but its targets don't appear on `/targets`
IntermediateTroubleshootingKubernetes monitoring and the Prometheus Operator
Answer
Likely causes → spec.selector does not match the Service's labels (not the pod labels), endpoints[].port refers to a port name that the Service doesn't define, or namespaceSelector is missing for a cross-namespace Service.
Diagnose →
kubectl get svc -n shop checkout --show-labels
kubectl get svc -n shop checkout -o jsonpath='{.spec.ports[*].name}'
kubectl get endpoints -n shop checkout
Fix → Match Service labels, use the named port (port: http-metrics) or targetPort, and add namespaceSelector: { matchNames: [shop] } if needed.
Prevent → Name metrics ports consistently (metrics).
More on Kubernetes monitoring and the Prometheus Operator
A new ServiceMonitor is not picked up by the Prometheus OperatorIntermediateServiceMonitor 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