Tim Dunphy
Tim Dunphy

Reputation: 889

Kubernetes - Windows 10 - connectex: No connection could be made because the target machine actively refused it

I've installed Kubernetes on windows 10 pro. I ran into a problem where the UI wasn't accepting the access token I had generated for some reason.

So I went into docker and reset the cluster so I could start over:

enter image description here

But now when I try to apply my configuration again I get an error:

kubectl apply -f .\recommended.yaml
Unable to connect to the server: dial tcp 127.0.0.1:61634: connectex: No connection could be made because the target machine actively refused it.

I have my KUBECONFIG variable set:

$env:KUBECONFIG
C:\Users\bluet\.kube\config

And I have let kubernetes know about the config with this command:

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

Yet, the issue remains! How can I resolve this? Docker seems fine.

Upvotes: 5

Views: 8556

Answers (2)

zeki kadiroğlu
zeki kadiroğlu

Reputation: 21

if you work on minikube in windows machine, try that: minikube start

Upvotes: 2

Tim Dunphy
Tim Dunphy

Reputation: 889

This stack overflow answered my question.

This is what it says:

If you have kubectl already installed and pointing to some other environment, such as minikube or a GKE cluster, be sure to change context so that kubectl is pointing to docker-desktop:

kubectl config get-contexts

kubectl config use-context docker-desktop

Apparently I had installed minikube which is what messed it up. Switching back to a docker context is what saved the day.

Upvotes: 11

Related Questions