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

Calls to `api.stripe.com` from Pods are slow, and CoreDNS logs show `api.stripe.com.payments.svc.cluster.local`, `api.stripe.com.svc.cluster.local` … all `NXDOMAIN`.

IntermediateTroubleshootingServices, DNS, Ingress and NetworkPolicy
Answer

Likely causes → The default ndots:5. Any name with fewer than 5 dots is first tried with every search domain, so one external lookup becomes 4–5 failed queries (times two for A and AAAA) before the real one.

Diagnose →

kubectl exec pay-x -- cat /etc/resolv.conf
# search payments.svc.cluster.local svc.cluster.local cluster.local ec2.internal
# options ndots:5

Fix → Lower ndots for Pods that mostly call external names, or use a fully qualified name with a trailing dot (api.stripe.com.):

dnsConfig:
  options:
    - {name: ndots, value: "2"}

Prevent → Deploy NodeLocal DNSCache and enable CoreDNS autopath or caching; set ndots in base charts for egress-heavy services.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Services, DNS, Ingress and NetworkPolicy