Skip to main content

ClusterIP

ClusterIP is the default Kubernetes Service type. It gives a set of pods one stable virtual IP and DNS name that is reachable only from inside the cluster, so other workloads can connect without tracking changing pod IPs.

Why ClusterIP exists

Pods are temporary and get new IPs when they restart. A ClusterIP Service gives clients a fixed address, and Kubernetes keeps the list of healthy backend pods behind it up to date. Most service-to-service traffic needs nothing more.

flowchart TD C["Client pod"] -->|"payments-service:4000"| S["ClusterIP Service
10.96.45.200"] S -->|"load balances"| A["Pod 10.244.1.21"] S -->|"load balances"| B["Pod 10.244.2.15"] S -->|"load balances"| D["Pod 10.244.3.8"] classDef client fill:#475569,color:#ffffff classDef svc fill:#FFEDD5,color:#1E293B classDef pod fill:#DBEAFE,color:#1E293B class C client class S svc class A,B,D pod

The virtual IP is not bound to any network interface. kube-proxy (or an eBPF dataplane such as Cilium) programs rules on every node that translate it to a real pod IP.

Example

YAML
apiVersion: v1
kind: Service
metadata:
name: payments-service
namespace: production
spec:
type: ClusterIP # default, can be omitted
selector:
app: payments-api
ports:
- protocol: TCP
port: 4000 # port the Service listens on
targetPort: 4000 # container port

Inspecting a ClusterIP Service

Bash
kubectl get service payments-service -n production
kubectl get endpointslices -n production -l kubernetes.io/service-name=payments-service
kubectl port-forward service/payments-service 4000:4000 -n production # local debugging

Service types at a glance

Type Reachable from
ClusterIP Inside the cluster only
NodePort Outside, via a port on every node
LoadBalancer Outside, via a cloud load balancer
ExternalName Maps to an external DNS name

Troubleshooting

Symptom Likely cause Fix
Connection refused No pods match the selector Empty endpoints means a label mismatch
Intermittent failures Some pods not Ready Check readiness probes
Cannot ping the IP Virtual IPs do not answer ICMP Test with the service port instead
Remember

A ClusterIP exists only in packet-rewrite rules. You cannot reach it from outside the cluster, and ping usually fails even from inside.

Common Mistake

Changing a Service port without updating its callers. Treat the port as a contract between teams.

Frequently Asked Questions

If ClusterIP is internal only, how does outside traffic reach pods?

Through something layered on top of it. NodePort and LoadBalancer Services extend the same selector for external access, and an Ingress or Gateway routes external requests to a ClusterIP Service inside the cluster.

What is a headless Service?

A Service with clusterIP set to None. It has no virtual IP and DNS returns the individual pod IPs, which StatefulSets use to give each pod its own DNS name.

Why does my Service silently drop traffic?

Usually its selector matches no pods, so it has zero endpoints. Check kubectl get endpointslices before debugging DNS or networking.

Found a mistake, an outdated step or a broken link?