Docker Community Forums

Share and learn in the Docker community.

Waiting for Kubernetes to be up and running


(Dalepres) #1

I just installed Docker for Windows 18.02 ce edge to try the Kubernetes functionality. I enabled Kubernetes and after applying or some other action, don’t remember exactly now, a progress dialog opened showing the installation of the Kubernetes cluster. It hung for over an hour with the slider looping hinting that it might be still doing stuff but it never seemed to finish. The only option was to “run in background” so I did that. I restarted Docker and still can’t connect to kubernetes. If I type “kubectl” I get a list of commands so the kubectl command exists in my powershell but if I type “kubectl version” I get this error:

Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.

I made sure the entry for ::1 localhost is in my hosts file and tried again with the same results.

I have read about Windows hijacking common web ports and I can’t use port 80 so I wonder if it’s the same for port 8080. I tried an nginx container using -p 80:80 and couldn’t get local port 80 to talk to nginx. I switched to -p 8080:80 and that worked fine for the nginx container so the port 8080 should be available for kubernetes since I stopped the nginx container.

How can I set the port for the kubernetes connection used by kubectl? Any other ideas on how to resolve this issue?

Thanks,

Dale


(Travian) #2

see my solution below:


(Travian) #3

Run this command as administrator before you activate Kubernetes. Worked for me in 18.03.0-ce-rc1 on Win10.

[Environment]::SetEnvironmentVariable("KUBECONFIG", $HOME + "\.kube\config", [EnvironmentVariableTarget]::Machine)


(Dalepres) #4

Thanks, Travian. I haven’t had time to try this yet but I hope to try it this weekend.


(Hdvries) #5

Also having this issue here, but still wont work. after the command


(Ugumba) #6

Thanks, this put me on the right track. This typically happens in domain environments, where %HOME% (or %HOMEDRIVE% and %HOMEPATH% - probably used by Kubernetes/kubectl to locate the config) do not match %USERPROFILE% (used by the Kubernetes installation to initialize the config).


(Aaronnbrock) #7

I’m in the same boat. What did you end up doing in order to get around this issue?


(Ugumba) #8

I set the KUBECONFIG system environment variable to the correct path, and rebooted. From then on, “kubectl config” displayed correct info.


(Aaronnbrock) #9

Thanks! That got me one step closer, but now I’ve run into this problem. I would put money on it that it’s some stupid issue with the corporate antiviruses. But we shall see.


(Henrikbach1) #10

Hi,

I also have this problem and set KUBECONFIG to $HOME/.kube/config and created the file, but in vein.

Which values should the ~/.kube/config contain for Kubernetes installed by Docker-for-Windows 18.06.0-ce-win72 (19098)?

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-21T09:17:39Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"windows/amd64"}
Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.

Help is appreciated.

Thank you.

/Henrik


(Henrikbach1) #11

I found why the above behavior appeared: The kubectl command should be run in a DOS shell context, not in cygwin/bash shell context. Even not in a new shell.

/Henrik


(Cforce) #12

Don’t works in Powershell, but standard CMD shell