A lightweight LVS baby care, support ipvs health check
A lightweight LVS baby care, support ipvs health check
A lightweight LVS baby care, support health check, currently only HTTP prober supported, sealos using lvscare for kubernetes masters HA.
If real server is unavailable, lvscare firstly set weight of rs to 0(for TCP graceful termination), and remove it from backends during the next check, if real server return to available, add it back. This is useful for kubernetes master HA.
prepend-iptables-chains: falselvscare care --run-once --vs 10.103.97.12:6443 --rs 192.168.0.2:6443 --rs 192.168.0.3:6443 --rs 192.168.0.4:6443run once mode just simply setup rules and exit. and it WON'T perform health checks.
Then kubeadm join can use 10.103.97.12:6443 instead of real masters.
Run lvscare as a static pod on every kubernetes workers. now control planes are also supported with link mode.
lvscare care --vs 10.103.97.12:6443 --rs 192.168.0.2:6443 --rs 192.168.0.3:6443 --rs 192.168.0.4:6443 --interval 5 --mode linkroute, from my test case seems route mode doesn't make sense..--health-status flag.Check with lvscare care --help command for more options.
If the real server is listening on the same host, you MUST run with link mode.
start some echoserver as real servers
docker run -p 8081:80 --name echoserver1 -d cilium/echoserver
docker run -p 8082:80 --name echoserver2 -d cilium/echoserver
docker run -p 8083:80 --name echoserver3 -d cilium/echoserverand run lvscare foreground
lvscare care --vs 169.254.0.1:80 --rs 127.0.0.1:8081 --rs 1.0.0.1:8082 --rs 127.0.0.1:8083 --logger DEBG --health-schem http --health-path / --mode linklink mode actually automatically setup rules below.
…create another terminal, check ipvs rules:
[root@VM-16-107-centos ~]# sudo ipvsadm -Ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 169.254.0.1:80 rr
-> 127.0.0.1:8080 Masq 1 0 2
-> 127.0.0.1:8081 Masq 1 0 2
-> 127.0.0.1:8082 Masq 1 0 2As you can see, all the real server had been added. Now you can perform a HTTP request to http://$vip:$port with curl:
…stop any of echoservers, and wait for 2 rounds(10s), then restart it
…you can observe logs from lvscare
2022-07-30T18:55:34 debug probe: Get "http://127.0.0.1:8083/": dial tcp 127.0.0.1:8083: connect: connection refused
2022-07-30T18:55:34 debug Trying to update wight to 0 for graceful termination
2022-07-30T18:55:39 debug probe: Get "http://127.0.0.1:8083/": dial tcp 127.0.0.1:8083: connect: connection refused
2022-07-30T18:55:39 debug Trying to delete real server
2022-07-30T18:55:44 debug probe: Get "http://127.0.0.1:8083/": dial tcp 127.0.0.1:8083: connect: connection refused
2022-07-30T18:55:49 debug Trying to add real server backBut the address is still accessible!
You can remove one or more, even destroy all of them and then check out IPVS rules.
Append -C or --clean option with lvscare command ran before.
lvscare care --vs 169.254.0.1:80 --logger DEBG --mode link -CWelcome to give it a shot, have fun with it.
This repository does NOT accept any form of contributions.
This includes:
All contributions must be submitted exclusively to the central repository:
https://github.com/labring/sealos
For bugs
→ Report in the Issues section of the main repository
→ Include reproduction steps and environment details
For code contributions
→ Submit changes via main repository only
→ Follow contribution guidelines at sealos/CONTRIBUTING.md
For feature requests
→ Create an Issue in the main repository with [Feature] prefix
⚠️ This repository is read-only
Any contributions made to this repository will be invalid
For your submissions to be considered, please use the central repository.
No open issues yet, or sync has not completed.