1

UPDATE This is slightly different than the posted comment asking if the linked question resolves my issue. The problem is that helm in the container is trying to connect to localhost which is not correct. It should be reading my information from the KUBECONFIG environment variable being passed in. Unless helm is trying to spin up a container and connect to that...which would definitely give a connection refused because that won't work.

ORIGINAL

We use a helm container in our CI environment to execute our helm commands and it works swimmingly. I am trying to replicate that success running helm from a container locally and not having much luck. I'm 99% sure it's a config issue, but I haven't been able to find any thing on the Internet specific to this situation. Here's the snippet docker command from my script. I've been testing with ls as the argument:

  docker run \
      -v $(pwd):/apps \
      -v "${HOME}/.kube:/root/.kube" \
      -v "${HOME}/.helm:/root/.helm" \
      -e KUBECONFIG=${HOME}/foo/kubeconfig \
      -it \
      -w "$(pwd)" \
      -ti \
      docker-dev.foo.com/bar/bat/helm helm "$@"

And here's the error I'm getting:

Error: Get http://localhost:8080/api/v1/namespaces/kube-system/pods?labelSelector=app%3Dhelm%2Cname%3Dtiller: dial tcp 127.0.0.1:8080: connect: connection refused

If I do a helm ls locally (I.e., outside the container), everything works just fine which is why I believe this is a config issue.

icfantv
  • 111
  • 4
  • Does this answer your question? [What causes the 'Connection Refused' message?](https://serverfault.com/questions/725262/what-causes-the-connection-refused-message) – Michael Hampton Nov 18 '20 at 05:42
  • Not directly. I mean, the problem is that it's trying to connect to `localhost` and not the config specified by my `KUBECONFIG`. But WHY it's trying to connect to `localhost` is not at all clear. – icfantv Nov 19 '20 at 06:23
  • Not my area, but if you are so sure it's a config problem, maybe posting your `${HOME}/foo/kubeconfig` file would be pertinent? The docker command should also be run as the same person who owns that $HOME location unless you have set specific permissions on the file/dir. – B. Shea Nov 28 '20 at 16:57
  • @bshea wouldn't make a difference in this particular case as that path is the same locally as is in the container and `helm` works just fine when running locally with that `$KUBECONFIG`. – icfantv Dec 01 '20 at 05:11

0 Answers0