Prompt
Why do my Kubernetes services keep timing out?
Latest observation
“Kubernetes services keep timing out” can happen for a bunch of different reasons, but the usual culprits are below. The fastest way to narrow it down is to check whether the problem is at the Service, Pod, DNS, network policy, or ingress/load balancer layer.
Common causes
1. Pods aren’t actually healthy or ready
A Service only sends traffic to Pods that are considered Ready.
Check:
kubectl get pods -o wide
kubectl get endpoints <service-name>
kubectl describe pod <pod-name>
If endpoints is empty, the Service has no healthy backend Pods.
Typical reasons:
- readiness probe failing
- app not listening on the right port
- app crashes or is slow to start
- selector doesn’t match pod labels
2. Service selector mismatch
If the Service selector doesn’t match the Pod labels, Kubernetes won’t route traffic.
Check:
kubectl get svc <service-name> -o yaml
kubectl get pods --show-labels
Make sure:
spec.selectorin the Service matches pod labels exactly- target port matches the container port correctly
3. Wrong port / targetPort
A very common issue is exposing one port but the container listens on another.
Check:
kubectl describe svc <service-name>
Look at:
porttargetPort- container
containerPort
Example mismatch:
- Service routes to
targetPort: 8080 - App listens on
3000
4. DNS issues
If the timeout happens when using a service name like myservice.default.svc.cluster.local, DNS may be broken.
Check from a Pod:
kubectl exec -it <pod-name> -- nslookup <service-name>
kubectl exec -it <pod-name> -- cat /etc/resolv.conf
Possible causes:
- CoreDNS down or overloaded
- wrong namespace in service name
- app using incorrect DNS name
5. NetworkPolicy blocking traffic
If your cluster uses NetworkPolicy, traffic between Pods may be denied.
Check:
kubectl get networkpolicy -A
If policies exist, verify:
- ingress allowed to the target Pods
- egress allowed from the source Pods
- namespace selectors / pod selectors are correct
6. Ingress or load balancer misconfiguration
If the timeout is from outside the cluster, the issue may be in:
- Ingress controller
- cloud load balancer
- firewall / security group
- service type mismatch
Check:
kubectl get ingress
kubectl describe ingress <name>
kubectl get svc <service-name> -o yaml
Make sure:
- Ingress points to the correct service and port
- Service type is correct (
ClusterIP,NodePort,LoadBalancer) - external firewall allows traffic
7. Application is slow or hanging
Sometimes Kubernetes is fine; the app itself is slow.
Check:
- app logs
- request latency
- CPU/memory saturation
- thread pool exhaustion
- database dependency delays
Commands:
kubectl logs <pod-name>
kubectl top pod
8. Liveness/readiness probes too aggressive
If probes are too strict, Pods may constantly become unready or restart.
Check:
kubectl describe pod <pod-name>
Look for:
- probe failures
- restarts
Readiness probe failedLiveness probe failed
9. Service type or endpoint access pattern is wrong
For example:
- trying to access a
ClusterIPservice from outside the cluster - using NodePort but connecting to the wrong node/port
- accessing headless services like normal services
Check service type:
kubectl get svc <service-name>
10. CNI / kube-proxy / cluster networking issue
If basic pod-to-pod traffic is failing, the cluster networking layer may be broken.
Check:
- can one pod
curlanother pod directly? - can you reach the service IP?
- are
kube-proxyand CNI pods healthy?
Commands:
kubectl get pods -n kube-system
kubectl get svc kube-dns -n kube-system
Quick troubleshooting flow
From inside a Pod in the same namespace:
- Resolve the service:
nslookup <service-name>
- Check endpoints:
kubectl get endpoints <service-name>
- Curl the service:
curl -v http://<service-name>:<port>
- Curl the Pod IP directly:
curl -v http://<pod-ip>:<container-port>
- If Pod IP works but Service IP doesn’t: likely Service/selector/kube-proxy issue
- If DNS fails: CoreDNS problem
- If both fail: app or pod networking issue
- If only from outside cluster: Ingress/LB/firewall issue
If you want, paste these and I can help pinpoint it:
kubectl get svc,endpoints,pods -o wide
kubectl describe svc <service-name>
kubectl describe pod <pod-name>
kubectl get networkpolicy -A
If you share the exact timeout symptom and service YAML, I can diagnose it more specifically.