Interview Prep/Monitoring & Observability/Prometheus scraping and targets

Target shows `x509: certificate is valid for app.svc, not 10.0.4.22`

IntermediateTroubleshootingPrometheus scraping and targets
Answer

Likely causes → Service discovery gives Prometheus a pod IP, but the cert SANs only contain DNS names.

Diagnose → Compare the __address__ on /targets with SANs: openssl s_client -connect 10.0.4.22:8443 </dev/null | openssl x509 -noout -ext subjectAltName.

Fix → Set tls_config.server_name: app.svc so verification uses the DNS name while connecting to the IP, or add IP SANs to the cert.

Prevent → Standardise on server_name for every TLS job scraped by IP.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus scraping and targets