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


Posted

in

by

Comments

2 responses to “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”

  1. Hammad Dar Avatar

    I am facing the same issue and I did what you recommended but in vain. It is still giving me the same error:

    PS C:\WINDOWS\system32> kubectl get nodes
    Unable to connect to the server: dial tcp 10.0.75.2:8443: connectex: No connection could be made because the target machine actively refused it.

  2. Kutafreta Avatar
    Kutafreta

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