端口8080上的Kubernetes连接被拒绝-Windows 10

时间:2019-01-30 12:03:28

标签: cmd kubernetes windows-10 environment-variables

通过安装kubectl后,Windows10上出现以下错误 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.

我创建了.kube文件夹(C:\Users\userA\.kube),并且其中有一个空的config文件

我设置了Windows环境变量:

Variable_nameKUBECONFIG valueC:\Users\userA\.kube\config

编辑:我使用running迷你库对其进行了测试:

enter image description here

2 个答案:

答案 0 :(得分:2)

您需要先使用以下命令启动服务器

minikube start

编辑:当op尝试使用hyper-v时,以下命令告诉minikube使用hyper-v

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

要进行此工作,还必须在hyper-v中设置一个名为“主虚拟交换机”的虚拟交换机。

答案 1 :(得分:0)

我自己知道了-在Windows 10上 如果您使用的是Hyper-V,则应打开Docker desktop,而对于minikube,应将其关闭。

关闭Hyper-V并重新启动PC后,minikube start可以正常工作。