Interview Prep/Monitoring & Observability/Kubernetes monitoring and the Prometheus Operator

ServiceMonitor target appears but Operator logs `skipping servicemonitor ... failed to get secret`

AdvancedTroubleshootingKubernetes monitoring and the Prometheus Operator
Answer

Likely causes → The ServiceMonitor references a basic auth / bearer / TLS Secret that is in a different namespace or missing; the Operator only reads Secrets in the ServiceMonitor's namespace.

Diagnose →

kubectl logs -n monitoring deploy/prometheus-operator | grep -i 'servicemonitor\|secret'
kubectl get secret -n shop

Fix → Create the Secret in the same namespace as the ServiceMonitor and reference it via basicAuth/authorization.credentials.

Prevent → Keep secrets beside the ServiceMonitor in the app's Helm chart.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Kubernetes monitoring and the Prometheus Operator