Kubernetes on Windows Error: Unable to connect to the server: dial tcp [::1]:6445: connectex: No connection could be made because the target machine actively refused it

In this blog post, I will show you how to fix the error message below when trying to use Kuberentes on Docker For Windows machine.

My Environment

In my case, I am using Windows 10 1709 build with Docker For Windows Edge channel build number 18.05.0-ce-rc1-win63.

Kubernetes Error message

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

Issue

The reason you are getting the error message is that Kuberentes is not looking into the correct configuration folder because the configuration path is not configured on the Windows 10 machine.

Solution

To fix the problem, I will run the command below that will tell Kubernetes where to find the configuration file on the machine.

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

Reset Kubernetes Cluster

After running the cmdlet above, I will reset Kubernetes cluster settings from the Docker properties menu under Reset

Once done, I can connect to my Kubernetes cluster

About Kubernetes

Kubernetes is an open-source system for automating deployment, scaling and management of containerized applications that was originally designed by Google and donated to the Cloud Native Computing Foundation.

This article was first published on DeployContainers.com

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.