Kubernetes ClusterIP versus headless service scenario

8/21/2020

I understand the concepts of a Kubernetes service ClusterIP and Headless service but when would I use one over the other?

-- Wunderbread
kubernetes
kubernetes-service

1 Answer

8/21/2020

The common case is to use ClusterIP for services within your cluster, unless you have a specific reason for another kind of Service.

For headless Services, a cluster IP is not allocated, kube-proxy does not handle these Services, and there is no load balancing or proxying done by the platform for them. How DNS is automatically configured depends on whether the Service has selectors defined

A specific reason for a headless service may be when you use StatefulSet.

-- Jonas
Source: StackOverflow