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

PodMonitor targets show `DOWN` with `connection refused` on port 8080 while the app listens on 9090

BeginnerTroubleshootingKubernetes monitoring and the Prometheus Operator
Answer

Likely causes → podMetricsEndpoints[].port names a container port that isn't the metrics port, or the container doesn't declare ports at all.

Diagnose → kubectl get pod <pod> -o jsonpath='{.spec.containers[*].ports}'.

Fix → Declare - name: metrics, containerPort: 9090 in the pod spec and use port: metrics.

Prevent → Lint deployments for a named metrics port.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Kubernetes monitoring and the Prometheus Operator