Skip to content
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

CPLB hairpining fails on vSphere #4700

Closed
juanluisvaladas opened this issue Jul 1, 2024 · 5 comments · May be fixed by #5279
Closed

CPLB hairpining fails on vSphere #4700

juanluisvaladas opened this issue Jul 1, 2024 · 5 comments · May be fixed by #5279
Assignees
Labels
area/network bug Something isn't working Stale
Milestone

Comments

@juanluisvaladas
Copy link
Contributor

juanluisvaladas commented Jul 1, 2024

Problem statement

After some investigation it was found that the all hosts reply to ARP requests to the virtual IP because the host has that virtual ip in the interface dummyvip0.

This behavior can be avoided easily by setting the sysctl net.ipv4.conf.<interface>.arp_ignore = 1. However this "randomly" breaks hairpining with IPVS. On other circumstances this could be avoided entirely using iptables nat table with PREROUTING and POSTROUTING rules, however in the scenario of calico + kube-proxy I have not been able to do this.

I think we'll need to have the following behavior:
1- When CPLB runs in controller+worker, forbid virtualServers in keepalived
2- For load balancing, introduce a reverse proxy. This could be something external like haproxy, nginx or envoy or an embedded library.

Reverse proxy

Golang library:

1- inetaf tcpproxy: Very simple, well written and uses Apache 2 license (my favourite option)
2- Caddy: links kubernetes libraries and isn't even up to date. Most likely very painful in the future
3- Golang's httputil/reverseproxy.go). We need a TCP reverse proxy because mTLS. We simply can't use this.
4- Kube-proxy: Userspace proxy doesn't exist anymore

External process

1- Nginx: Runs on everything except RISC-V (I've seen a fork on github) alpine build is less than 1Mb uncompressed and less than 500k. It has a few dependencies which aren't statically linked but I doubt it'd get much larger anyway:

/ # ldd  /usr/sbin/nginx
	/lib/ld-musl-x86_64.so.1 (0x7f3ab6e70000)
	libpcre.so.1 => /usr/lib/libpcre.so.1 (0x7f3ab6cfb000)
	libssl.so.3 => /lib/libssl.so.3 (0x7f3ab6c75000)
	libcrypto.so.3 => /lib/libcrypto.so.3 (0x7f3ab6858000)
	libz.so.1 => /lib/libz.so.1 (0x7f3ab683e000)
	libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f3ab6e70000)

2- Apache: similar numbers, haven't found any information about RISC-V.
3- Haproxy: Doesn't say anything about RISC-V support but I've seen compilations for RISC-V, I'm not sure if they are modified. Haproxy build for alpine is 3.2Mb uncompressed and 1.4Mb compressed. It links dynamically a few libraries:

/ # ldd /usr/sbin/haproxy
	/lib/ld-musl-x86_64.so.1 (0x7f8371f00000)
	libssl.so.3 => /lib/libssl.so.3 (0x7f83718da000)
	libcrypto.so.3 => /lib/libcrypto.so.3 (0x7f83714bd000)
	liblua-5.4.so.0 => /usr/lib/liblua-5.4.so.0 (0x7f8371487000)
	libz.so.1 => /lib/libz.so.1 (0x7f837146d000)
	libpcre2-8.so.0 => /usr/lib/libpcre2-8.so.0 (0x7f83713c6000)
	libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f8371f00000)

it could be statically linked and we can probably compile it in a way that doesn't require some of these...

4- Envoy: Envoy latest release nearly 70Mb for x86 architecture, gzip compressed around 24Mb and it also has limitations on the architectures it can run on.

@juanluisvaladas juanluisvaladas added the bug Something isn't working label Jul 1, 2024
@juanluisvaladas juanluisvaladas self-assigned this Jul 1, 2024
@jnummelin
Copy link
Member

My go-to choice would be https://github.com/inetaf/tcpproxy/ for couple reasons:

  • small in simple, but still suits our needs (AFAIK)
  • Pure Golang, no issues in future archs like RISCV etc.
  • Minimal deps (only one)

@juanluisvaladas juanluisvaladas added this to the 1.31 milestone Jul 4, 2024
@ncopa
Copy link
Collaborator

ncopa commented Jul 4, 2024

Nginx: Runs on everything except RISC-V

I'm pretty sure nginx runs on RISC-V.

alpine-ci-rv-2:~# uname -a
Linux alpine-ci-rv-2 5.10.113+ #1 SMP PREEMPT Tue Apr 23 11:57:43 UTC 2024 riscv64 Linux
alpine-ci-rv-2:~# apk add nginx
fetch http://dl-cdn.alpinelinux.org/alpine/edge/main/riscv64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/riscv64/APKINDEX.tar.gz
(1/4) Installing pcre (8.45-r3)
(2/4) Installing nginx (1.26.1-r2)
Executing nginx-1.26.1-r2.pre-install
Executing nginx-1.26.1-r2.post-install
(3/4) Installing nginx-openrc (1.26.1-r2)
(4/4) Installing nginx-vim (1.26.1-r2)
Executing busybox-1.36.1-r26.trigger
OK: 354 MiB in 105 packages
alpine-ci-rv-2:~# nginx -version
nginx version: nginx/1.26.1

@github-actions github-actions bot added the Stale label Aug 3, 2024
@k0sproject k0sproject deleted a comment from github-actions bot Aug 5, 2024
Copy link
Contributor

github-actions bot commented Sep 4, 2024

The issue is marked as stale since no activity has been recorded in 30 days

@github-actions github-actions bot added the Stale label Sep 4, 2024
@jnummelin jnummelin removed the Stale label Sep 6, 2024
@twz123 twz123 modified the milestones: 1.31, 1.32 Oct 2, 2024
Copy link
Contributor

github-actions bot commented Nov 1, 2024

The issue is marked as stale since no activity has been recorded in 30 days

Copy link
Contributor

github-actions bot commented Dec 4, 2024

The issue is marked as stale since no activity has been recorded in 30 days

@github-actions github-actions bot added the Stale label Dec 4, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/network bug Something isn't working Stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants