<p>I am learning about highly available distributed systems and some of the concepts that keep coming up are load balancing (Nginx) and container orchestration (Kubernetes). Right now my simplified understanding of them is as so:</p>
<h3>Nginx</h3>
<ul>
<li>Web server that handles Http requests</li>
<li>Performs load balancing via reverse proxy to other servers (usually done in a round robin manner)</li>
<li>Maps a single IP (the IP of the Nginx server) to many IPs (nodes which we are load balancing over).</li>
</ul>
<h3>Kubernetes</h3>
<ul>
<li>Container orchestration tool which keeps a defined state of a container cluster.</li>
<li>Maps a single IP (the IP of the control plane?) to many IPs (nodes which have a container instance running on them).</li>
</ul>
<p>So my question is, do we use both of these tools in conjunction? It seems like there is some overlap?</p>
<p>For example, if I was creating a NodeJS app to act as a microservice which exposes a REST API, would I just simply deploy my app in a Docker container, then let Kubernetes manage it? I would not need a load balancer like Nginx in front of my Kubernetes cluster?</p>

<p>Kubernetes gives you a self-contained/sandboxed environment where your services are safe from the outside world running on private non-routable subnets. Because pods are ephemeral, their IPs can change anytime. Hence, Kubernetes has a &quot;Service&quot; concept. Different micro-services interact with  each other using servicename:port so  that they don't have to worry about the POD  IPs.</p>
<p>However,if you want to access your application from outside (internet) you need to configure an ingress controller. This ingress controller can be implemented using Nginx.</p>
<p>So, your ingress controller (nginx) will receive request and send it  to the  service, which can load balance it to the pods to meet the desired state.</p>
<p>In large system, the nginx ingress controllers may need to scale as well to serve the incoming requests.</p>
<p>So, long story short, you will need both if you want to scale and for routing purposes.</p>
