Rancher-agent behind proxy

I try to launch ranger-agent on machine behind a proxy with the following command:

sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/rancher-agent:v2.1.7 --server https://example.com --token jrn9rpn9lcthxddwtmrhjsxk8hjs6mf55n4mflrxwmz6s685xzm76l --worker --etcd –controlplane

I get the following error :

level=error msg=“Failed to connect to proxy” error=“dial tcp: lookup example.com on 10.220.220.200:53: no such host”

Docker is configured to point to my http and https proxy.
When I launch a curl in a container, request thru the proxy is working.

I tried --add-host option to resolve this domain (even if it works on host and curl container) and I got:

level=error msg=“Failed to connect to proxy” error=“dial tcp 34.X.X.X:443: connect: connection refused”

If I add env var http_proxy an https_proxy to container, it does not change. If I put incorrect proxy, it displays that the proxy cannot be reached. My question is: “failed to connect proxy” is relative to http/s proxy or something else in Rancher?
Any idea why rancher-agent does not resolve domain and why connexion is refused whereas I can curl it?

1 Like