Interview Prep/Kubernetes/Services, DNS, Ingress and NetworkPolicy

A Pod can reach a Service in another namespace by ClusterIP but `curl https://orders.shop.svc` fails with a TLS error `x509: certificate is valid for orders.example.com, not orders.shop.svc`.

IntermediateTroubleshootingServices, DNS, Ingress and NetworkPolicy
Answer

Likely causes → The backend serves a certificate issued for its external name. The internal Service DNS name is not in the certificate SANs.

Diagnose →

kubectl run tls --rm -it --image=nicolaka/netshoot --restart=Never -- \
  openssl s_client -connect orders.shop.svc:443 -servername orders.shop.svc </dev/null 2>/dev/null | openssl x509 -noout -ext subjectAltName

Fix → Issue a certificate (cert-manager) that includes orders.shop.svc and orders.shop.svc.cluster.local, or call the internal endpoint over plain HTTP inside a mesh with mTLS.

Prevent → cert-manager Certificates with both external and internal DNS names for services that must use TLS in-cluster.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Services, DNS, Ingress and NetworkPolicy