A pod cannot resolve `my-svc` but can reach the pod IP. What do you test first?
BeginnerScenarioServices, Ingress and DNS
Answer
Situation read → DNS lookups fail inside the cluster.
What I'd do →
kubectl exec -it app -- nslookup my-svcandcat /etc/resolv.confkubectl get pods -n kube-system -l k8s-app=kube-dnskubectl logs -n kube-system -l k8s-app=kube-dns- Try the FQDN
my-svc.default.svc.cluster.local - Test from a different namespace, since short names only resolve within the same namespace
Why → The resolv.conf search path includes the pod namespace, so cross-namespace calls need svc.namespace.
Interview tip → Mention ndots:5 and its effect on lookup volume.
More on Services, Ingress and DNS
A Service has no endpoints. How do you find out why?BeginnerWhen do you use ClusterIP, NodePort, LoadBalancer and ExternalName?BeginnerTraffic to a Service works from some pods but times out from others. How do you debug it?AdvancedYou want to expose three HTTP services under one hostname with different paths. How?Intermediateingress-nginx returns 404 for a new host. What do you check?Intermediateingress-nginx returns 502 or 503 intermittently. What are the likely reasons?Intermediate