Kubernetes 101 : The Headless services - Talking directly to pods -



Headless services - bypassing services -:

When a client wants to connect directly to a pod without going through a service, it needs to know the IP address of that pod.


In the Yaml configuration file, we set the clusterIP to “none”, the client will discover the IP address of the pods through the DNS.

The below is the Yaml file a "headless service" which has no external IP address - address reachable from outside the kubernetes cluster -.

When an application does a DNS lookup, it will receive the IP addresses of the pods instead of the IP address of a cluster IP service.


Remark:

By setting the clusterIP to "None", we instruct the DNS to return the IP addresses of the pods instead of the IP address of the clusterIP service managing the pods.

To check the clusterIP service, we use:


We also could see the details of our "headless" service using the below command:


Comments

Leave as a comment:

Archive