rancher: Rancher agent does not use proxy environment in callback to rancher

What kind of request is this (question/bug/enhancement/feature request): Bug

Steps to reproduce (least amount of steps as possible): Import existing cluster into Rancher - with a proxy between that cluster and Rancher. Add to the agent yaml the required HTTP_PROXY, HTTPS_PROXY, NO_PROXY envs

Expected : Rancher cluster/node can contact Rancher and import is successful

Result: Rancher agent wss calls fail, log time=“2019-12-19T09:39:08Z” level=info msg=“Connecting to wss://rancher.foobar.com with token $token” time=“2019-12-19T09:39:08Z” level=info msg=“Connecting to proxy” url=“wss://rancher.foobar.com/v3/connect/register” time=“2019-12-19T09:39:18Z” level=error msg=“Failed to connect to proxy. Empty dialer response” error=“dial tcp :443: i/o timeout” time=“2019-12-19T09:39:18Z” level=error msg=“Remotedialer proxy error” error=“dial tcp $IP_OF_RANCHER:443: i/o timeout”

Other details that may be helpful: This is the same issue as rancher/rancher#24681 and rancher/rancher#22750 , sorry for opening a new one, but those are probably not clear enough. The problem is in remotedialer/client.go line 26 dialer = &websocket.Dialer{HandshakeTimeout:HandshakeTimeOut} should read instead dialer = &websocket.Dialer{HandshakeTimeout:HandshakeTimeOut,Proxy: http.ProxyFromEnvironment}

Environment information

  • Rancher version (rancher/rancher/rancher/server image tag or shown bottom left in the UI): 2.3.3 single install

gz#13523

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 21 (14 by maintainers)

Most upvoted comments

This bug also still exists in the latest release 2.4.3

@slickwarren The correct format for an envVar is as follows, and agentEnvVars can be successfully set via the API in this format in my testing on v2.5-head (03b8153): {"name":"HTTP_PROXY","value":"http://192.168.200.1:80"}

However, these do not propagate to the imported cluster cluster-agent YAML, due to a variable naming mismatch in https://github.com/rancher/rancher/pull/31024/commits/cd7f89a449c9c8678eaf8bc3c35d9031139740ff These are passed to the template as AgentEnvVars but the template references AgentEnvVar

Re opening this issue for validation.

No , it’s not resolved unfortunately . I ‘ll continue to try to make rancher people see it’s important … here is the pull request fixing it : https://github.com/rancher/remotedialer/pull/12

@ loganhz, is the issue resolved. it am still facing the same proxy issue in v.2.3.4

This bug still exists in 2.3.4

  • Edit imported cluster via API to add an agentEnvVars {"name":"HTTP_PROXY","value":"http://192.168.200.1:80"}

How do you do this step?