As Example my future Kubernetes system:
2 pods with replicas. Pod A after getting request from external client, have to get some info from pod B.
Question:
I read that simple ClusterIP service will redirect request to random pod with matching selector. So it looks like simple load balancer. Is it true? Or should I use internal (for kubernetes system) load balancer between pod A and pod B ?
CodePudding user response:
Use the clusterIP, if it's internal communication. No need to create the LoadBalancer service. Unless you want to expose the application outside.
Deployment A will manage all your A - PODs replicas, while Deployment B will create the same PODs and it's replicas.
When Any POD or deployment A requests to clusterIP service-B it will do the auto LoadBalancing across all available replicas of specific deployment.
The same goes, either way, any request hitting to service will do load-balancing across available replicas based on matching labels.