<p>I already had NGINX handling my reverse-proxy and load balancing for bare-metals and VMs, wonder if I can use the same instance for my Kubernetes cluster exposing services in load-balancer mode. If so, could I use it for both L4 and L7?</p>

Sam Wang
<p>You can't use it as type <a href="https://kubernetes.io/docs/concepts/services-networking/#loadbalancer" rel="nofollow noreferrer"><code>LoadBalancer</code></a> because there's no <a href="https://kubernetes.io/docs/concepts/cluster-administration/cloud-providers/" rel="nofollow noreferrer"><code>cloud-provider</code></a> API to handle an external Nginx instance.  You can do a couple of things I can think of:</p>

<ol>
<li><p>Create Kubernetes Service exposed on a <a href="https://kubernetes.io/docs/concepts/services-networking/#nodeport" rel="nofollow noreferrer"><code>NodePort</code></a>. So your architecture will look like this:</p>

<pre><code>External NGINX -&gt; Kubernetes NodePort Service -&gt; Pods
</code></pre></li>
<li><p>Create a Kubernetes <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">Ingress managed</a> by an ingress controller. The most popular happens to be <a href="https://kubernetes.github.io/ingress-nginx/" rel="nofollow noreferrer">Nginx</a>. So your architecture will look something like this:</p>

<pre><code>External NGINX -&gt; Kubernetes Service (has to be NodePort) -&gt; Ingress (NGINX) -&gt; Backend Service -&gt; Pods
</code></pre></li>
</ol>
