DEV Community

Sedat SALMAN
Sedat SALMAN

Posted on

Pod Running but App Unreachable? 5 Kubernetes Network Problems Explained and Fixed

Your Pod is Running, kubectl get pods looks healthy, and nobody can reach your app. The request is refused, the name doesn't resolve, or nginx answers 404. Running only tells you the container started. It says nothing about whether traffic can find it.

This post follows one request from the outside in, goes through the five problems that break it most often, and fixes each one with real terminal output. The video at the top covers the same ground in five and a half minutes, and each problem has a one-minute Short right where it comes up.

If your Pod isn't even Running yet, start with part 1 of this series:

The request path

A request from outside the cluster reaches the ingress controller, which picks an Ingress rule by host and path. The rule points to a Service. A Service doesn't run anything. It's a stable name and address that forwards traffic to the Pods its selector matches, but only the ones that are ready. That list of Pod addresses is the Service's endpoints.

Inside the cluster, Pods find Services by name through CoreDNS, and network policies decide which Pods may talk to which.

Each of the five problems below breaks one of those links:

  • No endpoints: the Service's selector matches no Pods, or the targetPort is wrong.
  • Readiness probe failed: the Pods are Running but not ready, so the Service skips them.
  • Bad address: the Service name doesn't resolve from the caller's namespace.
  • NetworkPolicy: a default-deny policy also blocks DNS.
  • Ingress 404: no Ingress rule matched the request.

The routine: start in the middle

  1. kubectl get endpoints <service>. No addresses means the Service can't use any Pod: check the selector, then readiness. Addresses but no answer usually means the port.
  2. Test from a temporary Pod inside the cluster, so you take the Ingress out of the picture:
$ kubectl run tmp --image=busybox:1.36 -- sleep 3600
pod/tmp created
Enter fullscreen mode Exit fullscreen mode

On Kubernetes 1.33 and later, kubectl get endpoints prints a deprecation warning. It still works, and kubectl get endpointslice -l kubernetes.io/service-name=<service> shows the same addresses. kubectl describe service lists them too.

1. No endpoints: the selector, then the targetPort

The orders Deployment runs two Pods, both Running and ready. A request to the orders Service is refused.

$ kubectl get pods -l app=orders
NAME                      READY   STATUS    RESTARTS   AGE
orders-9wh6qsk5sf-4jstr   1/1     Running   0          25s
orders-9wh6qsk5sf-n6vvb   1/1     Running   0          25s

$ kubectl exec tmp -- wget -qO- http://orders
wget: can't connect to remote host (10.97.139.202): Connection refused
command terminated with exit code 1

$ kubectl get endpoints orders
NAME     ENDPOINTS   AGE
orders   <none>      25s
Enter fullscreen mode Exit fullscreen mode

No endpoints, so the Service matches no Pods at all. Compare the selector with the Pod labels:

$ kubectl describe svc orders
Selector:                 app=order
TargetPort:               8080/TCP
Endpoints:                <none>

$ kubectl get pods -l app=orders --show-labels
orders-9wh6qsk5sf-4jstr   1/1     Running   0          25s   app=orders,pod-template-hash=9wh6qsk5sf
Enter fullscreen mode Exit fullscreen mode

The selector says app=order, the Pods say app=orders. A selector has to match every label it lists, and one missing letter means zero matches. Fix it:

$ kubectl patch svc orders -p \
  '{"spec":{"selector":{"app":"orders"}}}'
service/orders patched
$ kubectl get endpoints orders
orders   10.244.1.4:8080,10.244.2.4:8080   25s
$ kubectl exec tmp -- wget -qO- http://orders
wget: can't connect to remote host (10.97.139.202): Connection refused
Enter fullscreen mode Exit fullscreen mode

Two endpoints, and still refused. Look at the port: the Service sends traffic to 8080, but the container listens on 5678. Set the targetPort:

$ kubectl patch svc orders -p \
  '{"spec":{"ports":[{"port":80,"targetPort":5678}]}}'
service/orders patched
$ kubectl exec tmp -- wget -qO- http://orders
orders ok
Enter fullscreen mode Exit fullscreen mode

Rule of thumb: no endpoints? Check the selector. Endpoints, but refused? Check the targetPort.

2. Readiness probe failed: Running, but 0/1 ready

The web Deployment has a readiness probe on /ready. Both Pods are Running, and the Service has no endpoints again. This time the selector is fine.

$ kubectl get pods -l app=web
NAME                   READY   STATUS    RESTARTS   AGE
web-69zgj5p66w-jk4gg   0/1     Running   0          30s
web-69zgj5p66w-mdpdx   0/1     Running   0          30s

$ kubectl get endpoints web
NAME   ENDPOINTS   AGE
web    <none>      30s

$ kubectl exec tmp -- wget -qO- http://web
wget: can't connect to remote host (10.107.126.97): Connection refused

$ kubectl describe pod -l app=web
    Ready:          False
    Readiness:      http-get http://:80/ready delay=0s timeout=1s period=5s #success=1 #failure=3
  Warning  Unhealthy  3s (x6 over 28s)  kubelet  Readiness probe failed: HTTP probe failed with statuscode: 404
Enter fullscreen mode Exit fullscreen mode

nginx is running fine. It just has no /ready page, so every probe gets a 404.

The difference between the two probes matters here:

  • A failing liveness probe gets the container restarted.
  • A failing readiness probe restarts nothing. It keeps the Pod out of every Service that selects it until the probe passes.

So the Pods sit there, Running and invisible. Point the probe at a page that exists:

$ sed -i 's#path: /ready#path: /#' web.yaml
$ kubectl apply -f web.yaml
deployment.apps/web configured
$ kubectl rollout status deployment/web
deployment "web" successfully rolled out
$ kubectl get endpoints web
web    10.244.1.7:80,10.244.2.5:80   34s
Enter fullscreen mode Exit fullscreen mode

Rule of thumb: Running but not ready? Read the probe events in describe pod.

3. Bad address: the Service is in another namespace

A Pod in default calls catalog, and the name doesn't resolve.

$ kubectl exec tmp -- wget -qO- http://catalog
wget: bad address 'catalog'
command terminated with exit code 1

$ kubectl get svc -A
NAMESPACE       NAME                       TYPE        CLUSTER-IP       ...
backend         catalog                    ClusterIP   10.107.206.119   ...
default         kubernetes                 ClusterIP   10.96.0.1        ...
ingress-nginx   ingress-nginx-controller   NodePort    10.102.152.188   ...
kube-system     kube-dns                   ClusterIP   10.96.0.10       ...
kube-system     metrics-server             ClusterIP   10.104.46.139    ...
Enter fullscreen mode Exit fullscreen mode

catalog lives in backend. Now look at how the Pod resolves names:

$ kubectl exec tmp -- cat /etc/resolv.conf
search default.svc.cluster.local svc.cluster.local cluster.local
nameserver 10.96.0.10
options ndots:5
Enter fullscreen mode Exit fullscreen mode

The search list starts with the Pod's own namespace. So catalog is looked up as catalog.default.svc.cluster.local, and that name doesn't exist. Add the namespace, or use the full name:

$ kubectl exec tmp -- wget -qO- http://catalog.backend
catalog v1
$ kubectl exec tmp -- wget -qO- \
  http://catalog.backend.svc.cluster.local
catalog v1
Enter fullscreen mode Exit fullscreen mode

If even the full name fails, check CoreDNS itself in kube-system.

Rule of thumb: short names only work inside the same namespace. Across namespaces, use service.namespace.

4. NetworkPolicy: default-deny also blocks DNS

The shop namespace gets a default-deny policy for ingress and egress, plus two policies that let frontend reach api on port 5678, one for each direction. A connection needs the source's egress and the destination's ingress allowed, which is why there are two.

$ kubectl apply -f default-deny.yaml -f frontend-api.yaml
networkpolicy.networking.k8s.io/default-deny created
networkpolicy.networking.k8s.io/frontend-to-api created
networkpolicy.networking.k8s.io/api-from-frontend created

$ kubectl get netpol -n shop
NAME                POD-SELECTOR   AGE
api-from-frontend   app=api        0s
default-deny        <none>         0s
frontend-to-api     app=frontend   0s

$ kubectl exec -n shop frontend -- wget -qO- http://api
wget: bad address 'api'
command terminated with exit code 1
Enter fullscreen mode Exit fullscreen mode

Read the error again. A connection the policy blocks usually just times out. Bad address means the DNS lookup failed. Pods ask CoreDNS in kube-system on port 53, and with all egress denied, that request never leaves the namespace.

Allow DNS egress for every Pod in the namespace:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-dns
  namespace: shop
spec:
  podSelector: {}
  policyTypes: ["Egress"]
  egress:
  - to:
    - namespaceSelector:
        matchLabels:
          kubernetes.io/metadata.name: kube-system
    ports:
    - protocol: UDP
      port: 53
    - protocol: TCP
      port: 53
Enter fullscreen mode Exit fullscreen mode
$ kubectl apply -f allow-dns.yaml
networkpolicy.networking.k8s.io/allow-dns created
$ kubectl exec -n shop frontend -- wget -qO- http://api
api-ok

$ kubectl exec -n shop intruder -- wget -qO- -T 2 http://api
wget: download timed out
command terminated with exit code 1
Enter fullscreen mode Exit fullscreen mode

frontend gets through, and the intruder Pod times out, as it should. One more detail: these policies use the Pod port, 5678, not the Service port 80.

Rule of thumb: denied all egress? Allow DNS first.

5. Ingress 404: class, host and path

The shop Ingress routes shop.example.com to the web Service. The Service works from inside the cluster, but through the Ingress, nginx says 404.

$ kubectl exec tmp -- wget -qO- http://web
storefront

$ curl -s -H 'Host: shop.example.com' http://node01:30080/
<html>
<head><title>404 Not Found</title></head>
...
Enter fullscreen mode Exit fullscreen mode

That page comes from the ingress controller, not from your app. Requests that match no rule go to the controller's default backend, which answers 404. Check three things, in this order.

The class.

$ kubectl get ingress
NAME   CLASS   HOSTS              ADDRESS   PORTS   AGE
shop   ngnix   shop.example.com             80      10s

$ kubectl get ingressclass
NAME    CONTROLLER             PARAMETERS   AGE
nginx   k8s.io/ingress-nginx   <none>       15m
Enter fullscreen mode Exit fullscreen mode

The Ingress asks for ngnix, the cluster's class is nginx, so no controller picks it up. The empty ADDRESS column gives it away. Fix the class:

$ kubectl patch ingress shop -p \
  '{"spec":{"ingressClassName":"nginx"}}'
ingress.networking.k8s.io/shop patched
$ kubectl get ingress
NAME   CLASS   HOSTS              ADDRESS         PORTS   AGE
shop   nginx   shop.example.com   192.168.56.11   80      15s

$ curl -s -H 'Host: shop.example.com' http://node01:30080/
storefront
Enter fullscreen mode Exit fullscreen mode

The host. Call the node without the Host header and it's 404 again, because the rule is for shop.example.com:

$ curl -s http://node01:30080/
<html>
<head><title>404 Not Found</title></head>
...
Enter fullscreen mode Exit fullscreen mode

The path. With pathType: Prefix, matching works element by element: /api matches /api/orders, but not /apis.

A note on the controller: the Ingress NGINX project was retired in March 2026. Existing installs keep working but get no more releases or security fixes. The Ingress API itself is still supported, these three checks work the same with any Ingress controller, and for new setups the Kubernetes project recommends Gateway API.

Rule of thumb: Ingress 404? Check the class, the host and the path.

All five at once: checkout is down

PodSim's outage lab, S02, puts several of these in one namespace. It's Friday evening and checkout returns 503 through the Ingress. A 503 from nginx is different from a 404: the rule matched, but the Service had no ready Pod to send the request to.

The same routine finds it. get endpoints shows none. The Service's selector says app=check-out, the Pods say app=checkout. Fix that, and there are still no endpoints, because both Pods are Running but 0/1 ready: the readiness probe checks port 8080 and the app listens on 5678. Fix the probe, wait for the rollout, and checkout answers again.

There's one more broken Deployment in that lab, for a different reason. That one is yours to find.

Cheat sheet

What you see Where to look Usual cause
Refused, no endpoints get endpoints, describe svc Selector doesn't match the Pod labels
Refused, endpoints exist describe svc, container port targetPort points at the wrong port
No endpoints, Pods 0/1 ready describe pod, Events Readiness probe failing
bad address get svc -A, /etc/resolv.conf Service in another namespace, or DNS blocked
bad address with network policies get netpol Default-deny egress blocks port 53
Timeout with network policies get netpol The policy is blocking the connection
404 from nginx get ingress, get ingressclass Class, host or path doesn't match
503 from nginx get endpoints Rule matched, but no ready Pods

Try it yourself

Every terminal output above comes from PodSim, a free, open-source Kubernetes training simulator I'm building. It runs in your browser, so there's no cluster to set up, and each lab checks your fix.

Open sdtslmn.github.io/podsim, go to Labs, and pick:

  • I16 for a Service with no endpoints
  • I10 for readiness and liveness probes
  • B12 for Service DNS names
  • A11 for default-deny network policies
  • I18 for Ingress routing
  • S02 for the checkout outage

GitHub logo sdtslmn / podsim

PodSim: Kubernetes training simulator. Practice kubectl on a simulated cluster in the browser or terminal, with guided labs.

PodSim

A Kubernetes training simulator. Practice kubectl on a simulated cluster, in your terminal or in the browser, along a training path from your first Pod to real-life production scenarios. Every lab checks your work automatically, and a CKAD track with two timed mock exams prepares you for the certification.

Nothing here runs real containers. The simulator models how Kubernetes objects behave: the scheduler places Pods on nodes, the kubelet pulls images and starts containers, Deployments roll out new ReplicaSets, Services collect endpoints. You see the same states, events and error messages a real cluster gives you, without installing anything or paying for a cluster.

Try it in the browser: https://sdtslmn.github.io/podsim/

The browser version running the Services lab

Why a simulator

Real practice clusters (Killercoda, KodeKloud, kind, minikube) are great once you know the basics. For a first contact they are often too much: you wait for VMs, things break in ways that have nothing to do…




Keep going

Sources


Questions, or a network problem you keep running into? Leave a comment.

Kubernetes® is a registered trademark of The Linux Foundation. This post is independent and not affiliated with or endorsed by The Linux Foundation or the CNCF.

Top comments (0)