k3s agent cannot connect to server via proxy when flag --disable-apiserver-lb enabled #10918
-
I want to test connect k3s agent via Proxy and with flag --disable-apiserver-lb, because in actual environment my k3s-server is behind an external-loadbalancer In k3s-client VM, I export the [HTTP|HTTPS]_PROXY env, NO_PROXY=localhost,127.0.0.1
I try with curl and it's OK
I also try to start k3s server/agent by using systemd service but it had the same result |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Are you sure properly set the proxy env vars for the K3s service? You should put them in I can't say we've tested it with a proxy in between nodes. It is not generally expected that there would be a HTTP proxy between server and agent or the registration endpoint; there needs to be connectivity between all cluster nodes in order for the CNI overlay network (vxlan) to function properly so that pods and services are able to communicate. brandond@dev01:~$ kubectl get node -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
k3s-agent-1 Ready <none> 2m38s v1.29.6+k3s1 172.17.0.9 <none> K3s v1.29.6+k3s1 6.6.0-1001-aws containerd://1.7.17-k3s1
k3s-server-1 Ready control-plane,master 2m48s v1.29.6+k3s1 172.17.0.8 <none> K3s v1.29.6+k3s1 6.6.0-1001-aws containerd://1.7.17-k3s1
brandond@dev01:~$ kubectl get node -o yaml | grep node-args
k3s.io/node-args: '["agent","--token","********","--disable-apiserver-lb","--server","https://172.17.0.8:6443"]'
k3s.io/node-args: '["server","--token","********"]' |
Beta Was this translation helpful? Give feedback.
The
http.Client
we construct does not enable reading proxy config from the environment, since it's supposed to be talking to the local apiserver load-balancer endpoint and we wouldn't want to go through a proxy for that... so I suspect that no, it will not work through a proxy.k3s/pkg/clientaccess/token.go
Lines 260 to 266 in 40eda6a
The apiserver load-balancer does support use of a proxy, if you enable it via an env var:
k3s/pkg/agent/loadbalancer/servers.go
Lines 26 to 33 in 40eda6a