Pods running, app down: Kubernetes Services, from ClusterIP to Ingress
Why Services exist, how selectors find pods, when to use ClusterIP, NodePort, LoadBalancer or Ingress — and the one-character label typo that leaves a Service with nowhere to send traffic.
Watch the video
More on the channelYour pods are running. kubectl says 1/1 Ready. But open the app, and nothing loads. The Service exists.
So where is the traffic going?
To answer that, you need to know what a Service actually is — and the one check most people skip. We'll get to the bug at the end.
Why Services exist
Pods are temporary. Every restart, every rollout, every scale-up gives a pod a brand-new IP address. If your frontend talked to a pod's IP directly, it would break on every deploy.
That's why Kubernetes gives you a Service: one stable name and one stable virtual IP, in front of a changing group of pods.
How a Service finds its pods: labels, not names
A Service doesn't track pods by name. It uses a label selector:
apiVersion: v1
kind: Service
metadata:
name: checkout
namespace: shop
spec:
selector:
app: checkout # every ready pod with this label is an endpoint
ports:
- port: 80
targetPort: 8080- SelectorThe Service selects
app: checkout - EndpointsEvery ready pod carrying that label becomes an endpoint, listed in an EndpointSlice
- TrafficConnections to the Service are spread across those endpoints
- Pod replacedA pod dies; its replacement starts with the same label and is picked up automatically
The four ways to expose it
1 · ClusterIP — inside the cluster (the default)
ClusterIP gives the Service an internal virtual IP and a DNS name — checkout.shop.svc.cluster.local — reachable only from inside the cluster. It's what you want for service-to-service traffic, like your API talking to the database.
2 · NodePort — the same port on every node
NodePort opens the same port on every node, from the default range 30000–32767. Hit any node's IP on that port and you reach the Service. Simple and fine for testing, but you're exposing node IPs and high ports to the world.
3 · LoadBalancer — one real cloud load balancer
LoadBalancer asks your cloud provider for a real external load balancer with its own public IP, which forwards traffic into the cluster. Clean and production-ready — but every Service gets its own load balancer, and its own bill.
4 · Ingress — one entry point, many services
Ingress puts one load balancer and one entry point in front of many Services, with routing rules at layer 7:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: shop
namespace: shop
spec:
tls:
- hosts: [shop.example.com]
secretName: shop-tls
rules:
- host: shop.example.com
http:
paths:
- path: /api
pathType: Prefix
backend: { service: { name: api, port: { number: 80 } } }
- path: /checkout
pathType: Prefix
backend: { service: { name: checkout, port: { number: 80 } } }An ingress controller does the actual routing, and can terminate TLS too. The newer Gateway API takes the same idea further, with separate resources for the infrastructure team (the Gateway) and the app teams (the routes).
[!NOTE] ingress-nginx, for years the default controller, has been retired. For a new cluster, look at a maintained controller or go straight to Gateway API.
Which one, when?
| Type | Reachable from | Use it for | Watch out for |
|---|---|---|---|
| ClusterIP | Inside the cluster | Service-to-service traffic | Not reachable from outside at all |
| NodePort | Any node IP, port 30000–32767 | Quick tests, labs | Exposes node IPs and high ports |
| LoadBalancer | A public cloud IP | One public service | One load balancer (and bill) per Service |
| Ingress | One shared entry point | Many HTTP services by host/path, TLS | Needs an ingress controller running |
The bug: a Service with no endpoints
Back to our broken app. Follow the request one link at a time:
$ kubectl get svc checkout -n shop NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE checkout ClusterIP 10.96.41.207 <none> 80/TCP 3d $ kubectl get endpointslices -n shop -l kubernetes.io/service-name=checkout NAME ADDRESSTYPE PORTS ENDPOINTS AGE checkout-x7k2p IPv4 <unset> <unset> 3d
The Service exists and has a ClusterIP. But the EndpointSlice is empty — <unset>. The Service has nowhere to send traffic.
Compare the selector with the pods' labels:
$ kubectl get svc checkout -n shop -o jsonpath='{.spec.selector}'
{"app":"checkout"}
$ kubectl get pods -n shop --show-labels
NAME READY STATUS RESTARTS AGE LABELS
checkout-6b9f7d5c8d-4mzrx 1/1 Running 0 12m app=check-out,pod-template-hash=6b9f7d5c8dThe Service selects app=checkout. The new Deployment labels its pods app=check-out — with a hyphen. One character, and the labels no longer match. Fix the label in the Deployment's pod template, and the endpoints appear immediately:
$ kubectl get endpointslices -n shop -l kubernetes.io/service-name=checkout NAME ADDRESSTYPE PORTS ENDPOINTS AGE checkout-x7k2p IPv4 8080 10.244.2.31 3d
[!TIP]
kubectl get endpointsis deprecated in favour of EndpointSlices. Usekubectl get endpointslices -l kubernetes.io/service-name=<svc>— and when it shows<unset>, the selector doesn't match any ready pod.
Recap
Pods change; Services stay.
- ClusterIP for traffic inside the cluster.
- NodePort for quick access and tests.
- LoadBalancer for one public service.
- Ingress (or Gateway API) for many services behind one entry point.
And when a Service goes quiet, check the endpoints before you blame the network.
Which one do you run in production? Tell me in the comments on the video.