Tracing Service Connection Failures · CKA
Check name resolution, Service routing, and the application response separately.
Learn with progress and quizzesFirst, understand the concepts.
Investigation order
Check the Service, its selector and Pod labels, EndpointSlices, Pod readiness, targetPort and application, then network policies.
DNS versus connectivity
An application can fail to respond even when DNS works. Comparing IP-based and name-based access helps separate these issues.
Why it matters
Name lookup errors, refused connections, timeouts, and HTTP 500 responses are different clues. Record the exact symptom before selecting a layer to investigate.
Work through the reasoning
Break the path into segments
From the same client, compare name lookup, Service IP, and Pod IP behavior. A Service object can exist without backends; follow selectors, EndpointSlices, and readiness.
Turn symptoms into hypotheses
If only names fail, inspect DNS. If Pod IP works but the Service does not, inspect Service settings and the data path. HTTP 500 suggests a server handled the request; it is not automatically evidence of a network block.
Learn by doing.
You need kubectl and access to your own practice Kubernetes cluster. Each lab is independent. Check your current context first, then run the commands in your own terminal.
Replace SERVICE_NAME and NAMESPACE with actual values, then compare the Service with its backends.
kubectl get service SERVICE_NAME -n NAMESPACE -o yaml
kubectl get pods -n NAMESPACE -o wide --show-labels
kubectl get endpointslices -n NAMESPACE -l kubernetes.io/service-name=SERVICE_NAME -o yaml
kubectl get networkpolicy -n NAMESPACEHow to check your result
Verify that selectors match labels and that targetPort matches the application’s listening port. Note what you would investigate next.
Apply what you learned
DNS and EndpointSlice addresses look correct, but the app binds only to 127.0.0.1:8080. Can another Pod reach it?
Reveal the reasoning after trying
It listens only on that Pod’s loopback interface, so traffic to the Pod IP cannot reach that listener. Configure the intended listening interface, align targetPort, and retest from the original client.
Ready to check your understanding?
DNS resolves successfully, but the Service connection fails. What should you check next?
- Keep restarting DNS
- EndpointSlices, targetPort, and Pod status
- Browser history
- The length of the Deployment name
Reveal the reasoning after trying
EndpointSlices, targetPort, and Pod status
Investigate the connection path after name resolution. Check EndpointSlices, ports, Pod status, and policies in sequence.