0

When I use Service with type ClusterIP and 2 PODS, the traffic is distributed accross the 2 PODs.

I found another Service type LoadBalancer. What is the difference between the 2 types of Services? How is LoadBalancer different from ClusterIP ?

Thanks

Chandu
  • 1,205
  • 4
  • 19
  • 34
  • 2
    Does this answer your question? [What's the difference between ClusterIP, NodePort and LoadBalancer service types in Kubernetes?](https://stackoverflow.com/questions/41509439/whats-the-difference-between-clusterip-nodeport-and-loadbalancer-service-types) – Arghya Sadhu Jan 06 '20 at 08:29

1 Answers1

2

ClusterIP exposes the service on a cluster-internal IP. You cannot access this service from outside the cluster.

LoadBalancer assigns an external IP to the service in addition to cluster-internal IP. The external IP can be used to reach the service from outside the cluster. For LoadBalancer to work, you need a controller which assigns these external IP. Most cloud providers support LoadBalancer services.

Observe the TYPE and EXTERNAL-IP columns in the below output. Only LoadBalancer service has an EXTERNAL-IP assigned. This IP can be used to connect to the service from outside the cluster.

# kubectl get svc
NAME                                TYPE           CLUSTER-IP       EXTERNAL-IP    PORT(S)                                                                                                              AGE
jaeger-collector                    ClusterIP      10.111.127.254   <none>         14267/TCP,14268/TCP,9411/TCP                                                                                         36d
jaeger-query                        LoadBalancer   10.106.69.234    10.92.70.150   80:32131/TCP
Shashank V
  • 7,017
  • 1
  • 11
  • 32