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.
More on Prometheus scraping and targets
A target shows `DOWN` on `/targets` with `Get "http://10.0.3.14:9100/metrics": context deadline exceeded`BeginnerTarget is `DOWN` with `server returned HTTP status 401 Unauthorized`BeginnerTarget shows `server returned HTTP status 403 Forbidden` when scraping kubelet / cAdvisorIntermediateTarget is `DOWN` with `connect: connection refused`BeginnerTarget shows `x509: certificate signed by unknown authority`IntermediateA target is `UP` but `/targets` shows `expected a valid start token, got "<" ("INVALID") while parsing: "<"`Intermediate