【问题标题】:Minikube not working in Windows 8Minikube 无法在 Windows 8 中运行
【发布时间】:2025-12-16 01:25:02
【问题描述】:

我是 Kubernetes 新手。在 Kubernetes 文档的帮助下,我在我的 Windows 机器上安装了 minikube(v0.24.1) 和 kubectl。 VirtualBox(版本 5.1.18)也安装在我的机器上。

在启动minikube 之前,我已经在Windows 命令提示符下执行了set HTTP_PROXY=xx.xx.xx:8080set NO_PROXY=localhost,127.0.0.0/8,192.0.0.0/8

通过传递代理详细信息开始minikube

C:\minikube>minikube start --memory 4096  --vm-driver=virtualbox --docker-env http_proxy=xx.xx.xx:8080  --docker-env https_proxy=xx.xx.xx:8080 --docker-env no_proxy=localhost,127.0.0.0/8,192.0.0.0/8 --cache-images=false
Starting local Kubernetes v1.9.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.

来自 Kubectl 的错误:

C:\minikube>kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.0", GitCommit:"925c127ec6b946659ad0fd596fa959be43f0cc05", GitTreeState:"clean", BuildDate:"2017-12-15T21:07:38Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"windows/amd64"}
Unable to connect to the server: dial tcp 192.168.99.100:8443: connectex: An attempt was made to access a socket in a way forbidden by its access permissions.

Minikube 日志:

Feb 01 08:48:35 minikube localkube[2941]: E0201 08:48:35.223594    2941 proxier.go:1701] Failed to delete stale service IP 10.96.0.10 connections, error: error deleting connection tracking
 file not found in $PATH
Feb 01 08:48:38 minikube localkube[2941]: I0201 08:48:38.738404    2941 node_controller.go:857] Controller detected that some Nodes are Ready. Exiting master disruption mode.
Feb 01 08:48:45 minikube localkube[2941]: W0201 08:48:45.765543    2941 conversion.go:110] Could not get instant cpu stats: different number of cpus
Feb 01 08:48:55 minikube localkube[2941]: W0201 08:48:55.776172    2941 conversion.go:110] Could not get instant cpu stats: different number of cpus
Feb 01 08:49:24 minikube localkube[2941]: E0201 08:49:24.338731    2941 healthcheck.go:317] Failed to start node healthz on 0: listen tcp: address 0: missing port in address
Feb 01 08:50:24 minikube localkube[2941]: E0201 08:50:24.341890    2941 healthcheck.go:317] Failed to start node healthz on 0: listen tcp: address 0: missing port in address
Feb 01 08:51:24 minikube localkube[2941]: E0201 08:51:24.342845    2941 healthcheck.go:317] Failed to start node healthz on 0: listen tcp: address 0: missing port in address
Feb 01 08:52:24 minikube localkube[2941]: E0201 08:52:24.344497    2941 healthcheck.go:317] Failed to start node healthz on 0: listen tcp: address 0: missing port in address
Feb 01 08:53:24 minikube localkube[2941]: E0201 08:53:24.349095    2941 healthcheck.go:317] Failed to start node healthz on 0: listen tcp: address 0: missing port in address
Feb 01 08:54:24 minikube localkube[2941]: E0201 08:54:24.351143    2941 healthcheck.go:317] Failed to start node healthz on 0: listen tcp: address 0: missing port in address

如何解决这个问题?

【问题讨论】:

  • 你在代理后面吗?
  • 是的。我的 windows 机器在代理后面。
  • 如果“在代理之后”,您的意思是,安装 Kubernetes 和 minikube 之前,您已经有 HTTP(S)_PROXY 环境变量,那么您可以考虑设置一个NO_PROXY 环境变量,以便在访问您的 minikube IP 时使用代理。
  • 我已经按照命令 minikube start --docker-env http_proxy=http://xx.xx.xx:8080 \ --docker-env https_proxy=http://xx.xx.xx:8080 --docker-env no_proxy=192.168.99.0/24 启动了 minikube。但没有运气:(
  • 当我在命令提示符下执行 set NO_PROXY=192.168.0.0/16 并启动 minikube 时,当我尝试执行 kubectl get pod 时收到错误消息 Unable to connect to the server: dial tcp 192.168.99.102:8443: connectex: An attempt was made to access a socket in a way forbidden by its access permissions.

标签: windows kubernetes virtualbox kubectl minikube


【解决方案1】:

正如@ivthillo 已经指出的那样,问题可能是因为您在代理后面。在此链接中,他们解释了在您使用代理时配置 minikube 的解决方案:https://github.com/kubernetes/minikube/issues/530#issuecomment-250801735

尝试像这样启动 minikube:

minikube start --docker-env HTTP_PROXY=http://$YOURPROXY:PORT \ --docker-env HTTPS_PROXY=https://$YOURPROXY:PORT

这应该配置 docker 以使用您的代理。

这里他们还提出了其他解决方案:https://github.com/kubernetes/minikube/issues/530#issuecomment-347718692

【讨论】:

  • 我已经启动了上面评论中给出的 minikube。当我执行kubectl get pod 命令时,收到一条错误消息Unable to connect to the server: net/http: TLS handshake timeout
  • 你能做 minikube ssh 并尝试 curl google.com 吗?看起来它缺少 CA 机构
  • 当我使用minikube ssh登录minikube服务器并执行curl google.com时,得到curl: (7) Failed to connect to google.com port 80: Connection timed out的响应。如何在 minikube ssh 中设置代理
  • 又超时了,好像代理没有生效一样。您能否执行 env 以确认变量已设置(在 minikube 机器内)
  • minikube 机器内env 命令的输出:SSH_CONNECTION=10.0.2.2 52799 10.0.2.15 22 EDITOR=/bin/vi USER=docker PAGER=/bin/more PWD=/home/docker HOME=/home/docker SSH_CLIENT=10.0.2.2 52799 22 SSH_TTY=/dev/pts/0 MAIL=/var/mail/docker TERM=xterm SHELL=/bin/bash SHLVL=1 LOGNAME=docker PATH=/bin:/sbin:/usr/bin:/usr/sbin PS1=$ _=/bin/env