Endpoints exist, but `curl orders:80` returns `Connection refused`.
BeginnerTroubleshootingServices, DNS, Ingress and NetworkPolicy
Answer
Likely causes → The Service targetPort does not match the port the container listens on (e.g. targetPort: 80 while the app listens on 8080), or a named targetPort refers to a port name the container does not define.
Diagnose →
kubectl get svc orders -o jsonpath='{.spec.ports}'
kubectl get endpointslices -l kubernetes.io/service-name=orders -o jsonpath='{.items[*].ports}'
kubectl exec orders-x -- ss -lnt 2>/dev/null || kubectl debug -it orders-x --image=nicolaka/netshoot --target=app -- ss -lnt
Fix → Set targetPort to the real listen port, or better, to a named port defined on the container (name: http).
Prevent → Named ports everywhere, and a smoke test that curls the Service after deploy.
More on 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>`.BeginnerA Service works when you curl the Pod IP but times out on the ClusterIP from every node.IntermediateInside a Pod, `nslookup orders` returns `;; connection timed out; no servers could be reached`.BeginnerCoreDNS Pods are in CrashLoopBackOff with `[FATAL] plugin/loop: Loop (127.0.0.1:41823 -> :53) detected for zone "."`.IntermediateCalls 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`.IntermediateDNS lookups occasionally take exactly 5 seconds, then succeed.Advanced