techno-tim / k3s-ansible

The easiest way to bootstrap a self-hosted High Availability Kubernetes cluster. A fully automated HA k3s etcd install with kube-vip, MetalLB, and more. Build. Destroy. Repeat.
https://technotim.live/posts/k3s-etcd-ansible/
Apache License 2.0
2.41k stars 1.05k forks source link

Add option to disable MetalLB, for use w/ ext LBs #383

Closed balazshasprai closed 1 year ago

balazshasprai commented 1 year ago

Proposed Changes

Not sure how useful it'd be to the majority, since it's one of the project's best features. But I thought it would be nice to have the option to disable MetalLB altogether, too. (By default it still being enabled) Instead, you could use an external load balancer, like HAProxy, maybe on your pfSense/OPNsense instance, if you're using it for something already.

I've been using this project in my homelab and MetalLB is wonderful. Works great, very convenient. Now it seems we'll use this at work too, since you know, why reinvent the wheel? But, we already have big beefy purpose built hardware load balancers in use, we'd like to use them with a NodePort type ingress, without deviating / maintaining a separate fork of the project.

As you can see in the commit, I've only added a simple metal_lb_configure: true on/off switch, the default being on, and a condition in the k3s_server and k3s_server_post main.yml where the metallb tasks get included.

Checklist

balazshasprai commented 1 year ago

I swear github doesn't like me, ran the checks successfully before the pr

balazshasprai commented 1 year ago

I should probably add a default true var in the roles' defaults/main.yml too, so people who are using it with an already existing inventory don't run into undefined variable errors.

Edit: I added the defaults. Pretty new to github, didn't know the new commit would show up in this pr, pretty cool

timothystewart6 commented 1 year ago

Thank you! I am wondering if it would be better to just add tags that could be skipped, rather than adding a flag not to configure or install. See this PR. https://github.com/techno-tim/k3s-ansible/pull/373/files

balazshasprai commented 1 year ago

Oh yeah, that's way better! Pushed

timothystewart6 commented 1 year ago

Thank you!

timothystewart6 commented 1 year ago

I think we're missing it on a few more metallb resources

disregard!