kubectl get svc -AKubernetes Network Debugging Cheat Sheet
Debug Services, DNS, Ingress, network policies, connectivity, endpoints, and port-forwarding issues.
Services and Endpoints
kubectl describe svc <service> -n <namespace>kubectl get endpoints -AList EndpointSlices
Inspect endpoint slice distribution for a Service.
kubectl get endpointslices -ADescribe an EndpointSlice
Inspect ready addresses and ports at slice level.
kubectl describe endpointslice <name> -n <namespace>kubectl get svc <service> -n <namespace> -o jsonpath='{.spec.selector}{"
"}'DNS and Ingress
kubectl get ingress -Akubectl describe ingress <name> -n <namespace>Launch a temporary DNS utility pod
Create an interactive pod for nslookup and dig style checks.
kubectl run dnsutils -n <namespace> --image=registry.k8s.io/e2e-test-images/agnhost:2.39 --restart=Never -it --rm -- /bin/shResolve a service from inside a pod
Check internal DNS resolution using the full service name.
kubectl exec -it <pod> -n <namespace> -- nslookup <service>.<namespace>.svc.cluster.localResolve a service with getent
Alternate DNS check inside Linux-based containers.
kubectl exec -it <pod> -n <namespace> -- getent hosts <service>.<namespace>.svc.cluster.localkubectl get pods -n kube-system -l k8s-app=kube-dnskubectl logs -n kube-system -l k8s-app=kube-dns --all-containers=true --prefixConnectivity Testing
Port-forward to a service
Test an internal service from your workstation.
kubectl port-forward svc/<service> -n <namespace> 8080:80curl -i http://127.0.0.1:8080/Call a service from another pod
Validate in-cluster connectivity and service routing.
kubectl exec -it <pod> -n <namespace> -- curl -i http://<service>.<namespace>.svc.cluster.local:<port>/kubectl exec -it <pod> -n <namespace> -- wget -S -O- http://<service>:<port>/Test TCP connectivity with nc
Check if a target port is reachable from inside the cluster.
kubectl exec -it <pod> -n <namespace> -- nc -vz <service> <port>Show listening ports inside a pod
Inspect which ports the container is actually listening on.
kubectl exec -it <pod> -n <namespace> -- ss -lntupNetwork Policies
kubectl get networkpolicies -ADescribe a NetworkPolicy
Inspect ingress and egress selectors and ports.
kubectl describe networkpolicy <name> -n <namespace>kubectl get pod <pod> -n <namespace> --show-labelsTest outbound access from a pod
Validate whether egress is blocked by policy or firewall.
kubectl exec -it <pod> -n <namespace> -- curl -I https://example.comService Debug Playbook
Find pods selected by a service
Confirm that backend pods actually match the selector.
kubectl get pods -n <namespace> -l app=<label> -o wideCheck pod readiness gates for service endpoints
Non-ready pods usually do not appear as ready endpoints.
kubectl get pod <pod> -n <namespace> -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}{"
"}'Compare service and endpoints quickly
Display selector and endpoints in separate quick commands.
kubectl get svc <service> -n <namespace> -o yaml && kubectl get endpoints <service> -n <namespace> -o yaml