dockerkubernetesdocker-for-windows

No connection could be made because the target machine actively refused it. "Kubernetes on Docker for Windows"


I have installed the Edge version of Docker for Windows 18.05.0-ce (Windows 10 Hyper-V) and enabled Kubernetes afterwards.
On my other machine a kubectl context was created automatically, but on this new machine it was not.

> kubectl config get-contexts
CURRENT   NAME      CLUSTER   AUTHINFO   NAMESPACE
> 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.

Can i some how make Docker for Windows create the context?
Or can I set it up manually?
I am a little unsure how to get the infomation needed for the kubectl config set-context command.

I can run docker containers outside of Kubernetes.
I see the Kubernetes containers running inside Docker.

> docker ps
CONTAINER ID        IMAGE                            COMMAND
8285ca0dd57a        353b8f1d102e                     "kube-scheduler --ad…"
3b25fdb0b7a6        40c8d10b2d11                     "kube-controller-man…"
e81db90fa68e        e03746fe22c3                     "kube-apiserver --ad…"
2f19e723e0eb        80cc5ea4b547                     "/kube-dns --domain=…"
etc...

Solution

  • There is an issue with docker for windows when the HOMEDRIVE is set by a corporate policy.

    If you set the $KUBECONFIG environment variable to C:\Users\my_username\.kube\config (make sure the $HOME environment variables expand, don't use $HOME itself.), it should work.

    Further info: https://github.com/docker/for-win/issues/1651