Kubernetes connection refused on port 8080 - Windows 10

1/30/2019

I have following error on Windows10 after installing kubectl via choco install kubernetes-cli:

PowerShell

PS C:\Users\userA> kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:38:32Z", 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.

Cmd

C:\Users\userA>kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:38:32Z", 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.

I have created .kube folder (C:\Users\userA\.kube) and inside of it an empty config file

I set windows environment variable:

Variable_name: KUBECONFIG value: C:\Users\userA\.kube\config

EDIT: I tested it with running minikube:

enter image description here

-- tryingHard
cmd
environment-variables
kubernetes
windows-10

2 Answers

2/1/2019

I've figured it out myself - on Windows 10 Hyper-V should be turn on if you are using Docker desktop but for minikube it should be turn off.

When i had turned off Hyper-V and restarted my PC - then minikube start worked fine.

-- tryingHard
Source: StackOverflow

1/30/2019

You need to start the server first, with:

minikube start

Edit: As op tries to use hyper-v the following command tells minikube to use hyper-v

minikube start --vm-driver hyperv --hyperv-virtual-switch "Primary Virtual Switch"

To get this workling it is also neccessary to set a virtual switch named "Primary Virtual Switch" in hyper-v.

-- Simon
Source: StackOverflow