-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add kube-vip as a service load balancer #432
Conversation
Thank you for this! I love the idea of adding support for using Something like
I know that We just did something similar in #414 (making changes backwards compatible). Let me know what you think! Thanks! |
Also, if you are up to it, it would be great to have a molecule test for this. It will be a lot of copy and paste but would be helpful to know if it works and if future changes break it. You can also see #414 for an example test. Single nodes is fine! |
inventory/sample/group_vars/all.yml
Outdated
kube_vip_cloud_provider_tag_version: "main" | ||
|
||
# kube-vip ip range for load balancer | ||
kube_vip_lb_ip_range: "192.168.30.80-192.168.30.90" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking instead of having service_lb_type
we could just check to see if kube_vip_lb_ip_range
had values or metal_lb_ip_range
had values and infer which one to use based on that?
e.g. in this scenario kube-vip
would be used.
# metallb ip range for load balancer
#metal_lb_ip_range: "192.168.30.80-192.168.30.90"
# kube-vip ip range for load balancer
kube_vip_lb_ip_range: "192.168.30.80-192.168.30.90"
Then the default group vars could be:
# metallb ip range for load balancer
metal_lb_ip_range: "192.168.30.80-192.168.30.90"
# kube-vip ip range for load balancer
#kube_vip_lb_ip_range: "192.168.30.80-192.168.30.90"
This way someone would only need to uncomment kube-vip
and comment metal lb
and everything would work, we don't break the contract, and we don't need a type. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simplified the configuration according to your suggestion
I added a molecule scenario for kube-vip, based on single-node (similar to the calico scenario). Unfortunately I can't test this, it seems I can't get Vagrant to work on my laptop. |
Thank you! I just approved it for CI, so it will now run remote. I should write up a guide at some point for configuring molecule tests locally. Thank you for the test too! |
Looks like lint. You can fix it by installing pre-commit and it will fix it for you. |
Sorry for that, forgot to run it before commit... installed it now. |
The tests are passing but this is because metallb is still getting installed. https://github.com/techno-tim/k3s-ansible/actions/runs/7688568449/job/20950037294#step:13:222 I think you might need to add an override for metallb to unset the metallb IP range since it's in the default all group vars |
# Make sure that our IP ranges do not collide with those of the other scenarios | ||
apiserver_endpoint: "192.168.30.225" | ||
# Use kube-vip instead of MetalLB | ||
kube_vip_lb_ip_range: "192.168.30.110-192.168.30.119" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may need to add metal_lb_ip_range: ""
to unset this since the default is set.
What makes you believe that metallb is getting installed? The task is being skipped.
In fact, if you scroll further you see how kube-vip is being deployed.
No, the whole logic is relying on |
Thank you! You're right! I am not sure what I was looking at. Thank you for this! |
Proposed Changes
Thanks a lot for your work @timothystewart6, love to follow your tutorials! In the video for this project you mentioned that you didn't get kube-vip to work for services...
This PR allows to use kube-vip as loadbalancer for services, replacing MetalLB.
You can choose if you want to use MetalLB or kube-vip as the loadbalancer for services, just by changing variable
service_lb_type
to eithermetallb
orkube-vip
. The IP range for the service loadbalancer can be specified via theservice_lb_ip_range
variable.Breaking changes for existing inventories:
metal_lb_ip_range
has been renamed toservice_lb_ip_range
to reflect that the IP range is independent of the choice of loadbalancer for servicesChecklist
site.yml
playbookreset.yml
playbook