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

`curl http://orders.shop.svc.cluster.local` hangs, and `kubectl get endpointslices -l kubernetes.io/service-name=orders` shows `ENDPOINTS <unset>`.

BeginnerTroubleshootingServices, DNS, Ingress and NetworkPolicy
Answer

Likely causes → The Service selector matches no Ready Pods: label typo (app: order vs app: orders), Pods in another namespace, or all matching Pods failing readiness.

Diagnose →

kubectl get svc orders -n shop -o jsonpath='{.spec.selector}{"\n"}'
kubectl get pods -n shop --show-labels | grep orders
kubectl get pods -n shop -l app=orders     # use the exact selector

Fix → Align the Service selector with the Pod template labels, or fix readiness. Endpoints appear within seconds.

Prevent → Generate Service selectors and Pod labels from the same Helm helper; alert on Services with zero ready endpoints.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Services, DNS, Ingress and NetworkPolicy