Waiting for Kubernetes to be up and running

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

see my solution below:

1 Like

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)

2 Likes

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

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

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

1 Like

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

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

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.

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

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

Don’t works in Powershell, but standard CMD shell

Sorry to be late to the party but when I try to run your suggestion I get the error:

bash: syntax error near unexpected token `"KUBECONFIG",'

I’m very new to docker so I’m 99% sure I’ve done something stupid! Any help is much appreciated :slight_smile:

Thanks!

It worked for me as well.

Have you found a solution for this one. I am have set the KUBECONFIG path correctly but still Kubernetes hanging with the message “Cluster installation in progress”.

My experience ->
problem -> Post installing DockerDesktop, enabled kubernetes but the installation took forever and never completed.
solution -> factory reset DockerDesktop. set KUBECONFIG as mentioned in @travian `s comment. When i connected to internet via a completely different network than my office network, installation completed in 10 minutes.

after enabling kubernetes, ensure that you open a fresh powershell terminal window and check on it.