Have a couple of question on headless services:
clusterIP
field to None
.kubectl port-forward
), but the Headless Service creates DNS names for all the Pods so you can address them in a more general way.References:
Headless service doesn't carry any clusterIP, it just takes you directly to the particular pod that you need to communicate to, via its hostname.
Let's take example -
Say you installed kafka statefulset, running 3 brokers in it, now you want to communicate to one broker specifically then that can be done via headless service,
any normal service can do the random distribution of the traffic ( if you have not added any specific affinities in place), the normal service can also do for you, it's all based on use case scenarios