<p><strong>Intro:</strong></p>

<p>On AWS, Loadbalancers are expensive ($20/month + usage), so I'm looking for a way to achieve flexible load-balancing between the k8s nodes, without having to pay that expense. The load is not that big, so I don't need the scalability of the AWS load balancer any time soon. I just need services to be HA. I can get a small  EC2 instance for $3.5/month that can easily handle the current traffic, so I'm chasing that option now.</p>

<p><strong>Current setup</strong></p>

<p>Currently, I've set up a regular standalone Nginx instance (outside of k8s) that does load balancing between the nodes in my cluster, on which all services are set up to expose through NodePorts. This works really well, but whenever my cluster topology changes during restarts, adding, restarting or removing nodes, I have to manually update the upstream config on the Nginx instance, which is far from optimal, given that cluster nodes cannot be expected to stay around forever.</p>

<p><strong>So the question is:</strong></p>

<p>Can Trækfik be set up outside of Kubernetes to do simple load-balancing between the Kubernetes nodes, just like my Nginx setup, but keep the upstream/backend servers of the traefik config in sync with Kubernetes list of nodes, such that my Kubernetes services are still HA when I make changes to my node setup? All I really need is for Træfik to listen to the Kubernetes API and change the backend servers whenever the cluster changes. </p>

<p>Sounds simple, right? ;-)</p>

<p>When looking at the Træfik documentation, it seems to want an ingress resource to send its trafik to, and an ingress resource requires an ingress controller, which I guess, requires a load balancer to become accessible? Doesn't that defeat the purpose, or is there something I'm missing?</p>

<p>Here is something what would be useful in your case <a href="https://github.com/unibet/ext_nginx" rel="nofollow noreferrer">https://github.com/unibet/ext_nginx</a> but I'm note sure if project is still in development and configuration is probably hard as you need to allow external ingress to access internal k8s network.</p>

<p>Maybe you can try to do that on AWS level? You can add cron job on Nginx EC2 instance where you query AWS using CLI for all EC2 instances tagged as "k8s" and make update in nginx configuration if something changed.</p>
