Reputation: 23
I know the basic concept of ClusterIP
and Headless
services.
I think the key different is ClusterIP
do some sort of load balancing between underlying pods by applying some iptable rules.
Then Headless
just a list of ip addresses of pods registered in DNS.
And my question is, if ClusterIP
do the "load balancing" job, does that mean the ingress controller just do the routing but not load balancing?
What if using Headless
as the service type, can I configure the ingress controller and let it take over the load balancing job?
Thanks.
Upvotes: 0
Views: 526
Reputation: 2160
Service carries mapping to all of the pods registered with it via selector labels, and to send traffic to any of pods, it is just required to communicate to that service only and it will select some pod to route the request to, while headless service has nothing like clusterIP so it uses Pod's IP only, a chance to do direct communication with pods.
Say that you have a set of Kafka brokers deployed and you want to get info about a topic resting in one broker, then probably you can do that via headless service.
Now for these pods to talk to external world, they need to be exposed to load balancer layer, here comes the role of ingress that maps the domain URL to the backend services, and only ingress' service is exposed at the load balancer layer, rest remain under the hood.
The advantage of this is, you can attach firewall rules to ingress, URL rewrites can be done, sticky sessions can be implemented i.e. while services can't offer such things.
Upvotes: 1
Reputation: 4683
And my question is, if ClusterIP do the "load balancing" job, does that mean the ingress controller just do the routing but not load balancing?
AFAIK, Ingress
expose the certain Services
, and route external requests to multiple Services
. It usually integrated with Load balancer layers for handling external requests, but it's not just only for loadbalancing.
What if using Headless as the service type, can I configure the ingress controller and let it take over the load balancing job?
In use case of Headless
, it designed for self-managed application on load balancing and transaction management. Sometimes the clusterIP
load balancing on Kubernetes would not fit to the application or middleware which already has their own features with the same things.
Upvotes: 0