Home
Help
Search
Login
Register
OPNsense Forum
»
Archive
»
21.1 Legacy Series
»
Kubernetes best load balancer setup ?
« previous
next »
Print
Pages: [
1
]
Author
Topic: Kubernetes best load balancer setup ? (Read 8203 times)
Voodoo
Newbie
Posts: 49
Karma: 4
Kubernetes best load balancer setup ?
«
on:
March 17, 2021, 08:42:29 pm »
Has anyone a kubernetes setup with opnsense ?
There is barely content about it so I did some research and testing myself.
Opnsense does not come with load balancing by default but offers 3 plugins: os-relayd, os-nginx and os-haproxy
os-relayd was deprecated in the past, solely for load balancing.
os-nginx and os-haproxy are mainly for http reverse proxying, os-haproxy has some more load balancing options but lacks udp load balancing if required.
os-nginx lacks load balancing algorithms, round robin is the only one but that's a limitation of the opnsense gui.
Best option for future support seems to be os-haproxy.
Logged
SFC
Newbie
Posts: 30
Karma: 3
Re: Kubernetes best load balancer setup ?
«
Reply #1 on:
March 18, 2021, 01:47:33 am »
What exactly would you be using the proxy for? OPNsense would need to live outside of your k8s cluster which is why you likely won't find anyone doing it. It can't be spun up as a pod, k8s is linux/windows only, there is no bsd support.
Logged
wallaby501
Newbie
Posts: 12
Karma: 0
Re: Kubernetes best load balancer setup ?
«
Reply #2 on:
March 25, 2021, 01:27:36 am »
I actually somehow got this going after a lot of trial and error (still not sure it's correct.) I will update this post when I'm back at my computer with details on what to configure and how.
Logged
wallaby501
Newbie
Posts: 12
Karma: 0
Re: Kubernetes best load balancer setup ?
«
Reply #3 on:
March 25, 2021, 03:38:56 pm »
So it was a bit different coming from pfsense but this is working so far. I'm sure there are some tweaks needing to be made but it does load balance properly.
1) Make a VIP as the load balancer under Interfaces-Virtual IPs (IP alias)
2) In Services-haproxy-Real Servers set up your real servers as the actual control plane nodes- IP, port, and do not check SSL
3) Go to Rules and Checks and make a healthcheck- http, GET, healthz, HTTP1.1 version, and the FQDN of your VIP host (load balancer FQDN). Do click "Force SSL" as you need that for the check.
3) Click on virtual services and make your backend pool comprising those nodes from above. TCP, Source-IP hash seems fine, your servers, enable health checking and select your check you just made, and set stick table persistence to source-ip.
4) Click virtual services dropdown arrow and then Public Service. This is the frontend. Select your listen addresses (VIP FQDN and IP), TCP, select the backend pool you just made. I didn't do anything else to this.
5) Settings-Service. Save and test the syntax and check the boxes to enable haproxy and then hit apply.
Should be good to go then.
«
Last Edit: March 25, 2021, 03:40:29 pm by wallaby501
»
Logged
mimugmail
Hero Member
Posts: 6765
Karma: 494
Re: Kubernetes best load balancer setup ?
«
Reply #4 on:
March 26, 2021, 06:39:47 am »
Not sure if this is relevant here, I added traefik and caddy2 pkg's to my community repo.
If you can work with this I can also try adding a plugin.
https://www.routerperformance.net/opnsense-repo/
Logged
WWW:
www.routerperformance.net
Support plans:
https://www.max-it.de/en/it-services/opnsense/
Commercial Plugins (German):
https://opnsense.max-it.de/
Voodoo
Newbie
Posts: 49
Karma: 4
Re: Kubernetes best load balancer setup ?
«
Reply #5 on:
March 27, 2021, 12:43:44 am »
@SFC opnsense is the upstream gateway for the cluster and ha requires load balancing.
@mimugmail traefik plugin sounds nice, I will set it up for ingress cli is more then fine, no eta yet though.
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
Archive
»
21.1 Legacy Series
»
Kubernetes best load balancer setup ?