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.


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 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.

  • Does this answer your question? What causes the 'Connection Refused' message? Commented Nov 18, 2020 at 5: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
    Commented Nov 19, 2020 at 6: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
    Commented Nov 28, 2020 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
    Commented Dec 1, 2020 at 5:11


You must log in to answer this question.

Browse other questions tagged .