<p>I've been studying Kubernetes for a few weeks now, and using the kube-lego NGINX examples (<a href="https://github.com/jetstack/kube-lego" rel="noreferrer">https://github.com/jetstack/kube-lego</a>) have successfully deployed services to Kubernetes cluster using Rancher on DigitalOcean.</p>

<p>I've deployed sample static sites, Wordpress, Laravel, Craft CMS, etc. All of which use custom Namespaces, Deployment, Secrets, Containers with external registries, Services, and Ingress Definitions.</p>

<p>Using the example (lego) NGINX Ingress Controller setup, I'm able to apply DNS to the exposed IP address of my K8s cluster, and have the resulting sites appear.</p>

<p>What I don't know, though, is how to allow for multiple hosts to have Ingress Controllers service the same deployments, and thus provide HA Ingress to the cluster. (by applying an external load balancer service, or geo-ip, or what-have-you).</p>

<p>Rancher (stable) allows me to add multiple hosts, I've spun up 3 to 5 at a time, and Kubernetes is configured and deployed across all Hosts. Furthermore, I'll define many replicas and/or deployments (listed above) and they will be spread over the cluster and accessible as would be expected. I've even specified multiple replicas of the Ingress Controller, but of course they all get scheduled on the same host, giving me only one IP address of Ingress.</p>

<p>So how do I allow multiple hosts (each with their own public facing IP address) to allow ingress into the cluster? I've also read about setting up multiple Ingress Controllers, but then you must specify what deployment/services are being serviced by what Ingress Controller, which then totally defeats the purpose.</p>

<p>Maybe I'm missing something, but if K8s multi-host is supposed to provide HA, and the Host with the Ingress Controller goes down, then the service will be rescheduled on the other Hosts, but the IP address that everything is pointing to will be dead, and thus an outage. Any way to have multiple IP Addresses to the same set of deployment/services?</p>

<p>I investigated my setup a bit more today, and I think I found out why I was having difficulty. The "LoadBalancer" is often mentioned as for use with Cloud Providers (in both docs, and what @fiunchinho describes). I was using it with a Rancher setup, which auto creates an HA-Proxy LoadBalancer ingress for you on the hosts.</p>

<p>By default, it will just schedule it on one of the hosts. You can specify that you want it scheduled globally buy providing an 'annotation' of <code>io.rancher.scheduler.global: "true"</code>.</p>

<p>Like so:</p>

<pre><code>annotations:
  # Create load balancers on every host in the environment
  io.rancher.scheduler.global: "true"
</code></pre>

<p><a href="http://rancher.com/docs/rancher/v1.6/en/rancher-services/load-balancer/" rel="noreferrer">http://rancher.com/docs/rancher/v1.6/en/rancher-services/load-balancer/</a></p>

<p>I preferred LoadBalancer over NodePort because I wanted the ability to send port 80 (and in the future port 443) to any of the Nodes, and have them successfully fulfil my request by inspecting the Host header, and directing as-needed.</p>

<p>These LBs can also be setup in the Rancher UI under the "Infrastructure Stack" menu. I have successfully removed the single LB, and re-added one with an "Always run one instance of this container on every host" option enabled.</p>

<p>After this was configured, I could make a request to any of the Hosts for any of the Ingresses, and get a response, no matter what host the container was scheduled on.</p>

<p><a href="https://rancher.com/docs/rancher/v1.6/en/rancher-services/load-balancer/" rel="noreferrer">https://rancher.com/docs/rancher/v1.6/en/rancher-services/load-balancer/</a></p>

<p>So cool!</p>
