Kubernetes Services Explained: ClusterIP, NodePort, LoadBalancer and Headless

How Kubernetes Services give pods stable networking: selectors, endpoints, ClusterIP, NodePort, LoadBalancer, headless services, DNS names and debugging.

Published December 1, 2026

Pods come and go, and each new pod gets a new IP address. A Service gives a group of pods a stable virtual IP and DNS name, and load-balances traffic across whichever pods are currently ready. Choosing the right Service type determines whether your app is reachable only inside the cluster, from the nodes, or from the internet.

The concept

A Service selects pods by labels. Kubernetes tracks the matching ready pods in EndpointSlices, and kube-proxy (or an eBPF dataplane) programs the node so traffic to the Service IP is forwarded to one of those pod IPs. Cluster DNS gives every Service a name like orders.shop.svc.cluster.local, so applications connect by name instead of IP.

ClusterIP (the default) is reachable only inside the cluster. NodePort additionally opens a port (30000-32767 by default) on every node. LoadBalancer asks the cloud provider (or MetalLB on bare metal) for an external load balancer that forwards to the Service. A headless Service (clusterIP: None) skips the virtual IP and returns individual pod IPs from DNS, which StatefulSets and client-side load balancing use.

Service types

TypeReachable fromTypical use
ClusterIPInside the clusterInternal APIs, databases, caches
NodePortNode IP:portSimple external access, behind your own LB
LoadBalancerExternal IP from cloud LBExpose a service directly to the internet
Headless (None)DNS returns pod IPsStatefulSets, client-side balancing
ExternalNameDNS CNAME to external hostAlias an external service

How traffic is routed

Client podorders.shop.svcService ordersClusterIP 10.96.12.7:80pod orders-a10.244.1.5:8080pod orders-b10.244.2.9:8080pod orders-c10.244.3.4:8080
A Service load-balances across ready pods matched by its selector.

LoadBalancer layering

443forwardkube-proxyendpointsInternetCloud LBexternal IPNodePortevery nodeServiceClusterIPPods
A LoadBalancer Service builds on NodePort and ClusterIP.

Practical examples

A ClusterIP Service

port is what clients use; targetPort is the container port.

apiVersion: v1
kind: Service
metadata: { name: orders, namespace: shop }
spec:
  selector: { app: orders }
  ports:
    - name: http
      port: 80
      targetPort: 8080

Debug a Service that returns nothing

Most issues are selectors or readiness.

kubectl get endpointslices -l kubernetes.io/service-name=orders -n shop
kubectl get pods -n shop -l app=orders --show-labels
kubectl run tmp --rm -it --image=busybox -n shop -- wget -qO- http://orders/health

Port-forward for local testing

Reach a ClusterIP Service from your laptop.

kubectl port-forward svc/orders 8080:80 -n shop
curl localhost:8080/health

Common mistakes

  • Selector labels that do not match pod labels, leaving the Service with no endpoints.
  • Pods not ready (failing readiness probe), so they are excluded from endpoints.
  • One LoadBalancer Service per app, multiplying cloud load balancer costs instead of using Ingress/Gateway.
  • Confusing port and targetPort.

Key takeaways

  • Services give pods a stable IP and DNS name.
  • ClusterIP internal, NodePort node-level, LoadBalancer external, headless for pod DNS.
  • Endpoints include only ready pods matching the selector.
  • Debug with endpointslices, labels and a test pod.

FAQ

Does a Service load-balance per request?

kube-proxy balances per connection; long-lived connections (HTTP/2, gRPC) may stick to one pod, so use client-side balancing or a mesh for even distribution.

How do I expose many HTTP services?

Use an Ingress controller or the Gateway API with one load balancer routing by host and path.

Can a Service point to things outside the cluster?

Yes, with ExternalName or a Service without a selector plus manually managed endpoints.

More DevOps articles