<p>I have read <a href="https://stackoverflow.com/questions/55965342/kubernetes-load-balancing">this question</a> which is very similar to what I am asking, but still wanted to write a new question since the accepted answer there seems very incomplete and also potentially wrong.</p>
<p>Basically, it seems like there is some missing or contradictory information regarding built in load-balancing for regular Kubernetes Services (I am not talking about LoadBalancer services). For example, the official <a href="https://cilium.io/get-started/" rel="nofollow noreferrer">Cilium documentation</a> states that &quot;Kubernetes doesn't come with an implementation of Load Balancing&quot;. In addition, I couldn't find any information in the official Kubernetes documentation about load balancing for internal services (there was only <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#load-balancing" rel="nofollow noreferrer">a section discussing this under ingresses</a>).</p>
<p>So my question is - how does load balancing or distribution of requests work when we make a request from within a Kubernetes cluster to the internal address of a Kubernetes service?</p>
<p>I know there's a Kubernetes proxy on each node that creates the DNS records for such services, but what about services that span multiple pods and nodes? There's got to be some form of request distribution or load-balancing, or else this just wouldn't work at all, no?</p>

<p>A standard Kubernetes <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">Service</a> provides basic load-balancing.  Even for a ClusterIP-type Service, the Service has its own cluster-internal IP address and DNS name, and forwards requests to the collection of Pods specified by its <code>selector:</code>.</p>
<p>In normal use, it is enough to create a multiple-replica Deployment, set a Service to point at its Pods, and send requests only to the Service.  All of the replicas will receive requests.</p>
<p>The documentation discusses <a href="https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies" rel="nofollow noreferrer">the implementation of internal load balancing</a> in more detail than an application developer normally needs.  Unless your cluster administrator has done extra setup, you'll probably get round-robin request routing – the first Pod will receive the first request, the second Pod the second, and so on.</p>
<blockquote>
<p>... the official Cilium documentation states ...</p>
</blockquote>
<p>This is almost certainly a statement about <em>external</em> load balancing.  As a cluster administrator (not a programmer) a &quot;plain&quot; Kubernetes installation doesn't include an external load-balancer implementation, and a LoadBalancer-type Service behaves identically to a NodePort-type Service.</p>
<p>There are obvious deficiencies to round-robin scheduling, most notably if you do wind up having individual network requests that take a long time and a lot of resource to service.  As an application developer the best way to address this is to make these very-long-running requests run asynchronously; return something like an HTTP 201 Created status with a unique per-job URL, and do the actual work in a separate queue-backed worker.</p>
