<p>I'm studing Kubernetes (with no regard of a specific Cloud Provider) and it's not so clear if the most generic Service (not the Service of type Load-Balancer) works as an internal load balancer among the various replicas of a single microservice.</p>

<p>So <strong>how to implement internal load balancing among replicas without exposing the microservice to the outside traffic</strong>?</p>

Alessandro Argentieri
<p>You can use kubernetes service object which is top of the pod.</p>

<p>Service object manage the connection and traffic it can be also used as internal load balancer.</p>

<p>You can create service with yaml file</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: myapp-service
spec:
  selector:
    app: Myapp
  ports:
  - port: 80
    targetPort: 9376
</code></pre>

<p>On the base of the same selector in pod metadata to divert the traffic to that pods.
Just use proper selector in specs section inside service and pods.</p>
