Traffic to a Service works from some pods but times out from others. How do you debug it?
AdvancedScenarioServices, Ingress and DNS
Answer
Situation read → Only pods on certain nodes fail to reach the ClusterIP.
What I'd do →
- Run
kubectl run tmp --rm -it --image=nicolaka/netshoot -- bashon the failing node usingnodeName curl -v <clusterIP>:<port>andcurl <podIP>:<targetPort>to separate Service from pod networking- Check kube-proxy on that node with
kubectl -n kube-system logs ds/kube-proxy - On the node inspect
iptables-save | grep <svc>oripvsadm -Ln - Check the CNI pod health and node security groups or firewall
Why → If pod IP works but ClusterIP does not, the issue is kube-proxy rules. If pod IP fails too, it is the CNI or network policy.
Interview tip → Separate the layers: pod to pod, pod to Service, external to Service.
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?BeginnerYou 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?IntermediateA pod cannot resolve `my-svc` but can reach the pod IP. What do you test first?Beginner