无法从浏览器访问我的 minikube 集群(?因为您在 Windows 上使用 Docker 驱动程序,所以需要打开终端才能运行它。)

Mo *_*eri 9 docker kubernetes minikube

我正在尝试从浏览器访问一个简单的 minikube 集群,但我不断收到以下信息:\n\xe2\x9d\x97 Because you are using a Docker driver on windows, the terminal needs to be open to run it.

\n

我已经为集群创建了一个外部服务,端口号为 30384,并且我在 docker 容器中运行 minikube。

\n

我正在按照“Hello Minikube”示例来创建我的部署。

\n

第 1 步:我创建了部署:

\n

kubectl create deployment hello-node --image=k8s.gcr.io/echoserver:1.4

\n

第 2 步:我创建了外部服务:\nkubectl expose deployment hello-node --type=LoadBalancer --port=8080

\n

第三步:我运行了该服务,这就是我塞满的地方\n”minikube service hello-node

\n

完整的返回消息:

\n

\xe2\x9d\x97 Executing "docker container inspect minikube --format={{.State.Status}}" took an unusually long time: 2.3796077s\n Restarting the docker service may improve performance.\n Starting tunnel for service hello-node.\n Opening service default/hello-node in default browser...\n\xe2\x9d\x97 Because you are using a Docker driver on windows, the terminal needs to be open to run it.

\n

我尝试运行该服务以使其可以从浏览器访问,但是我无法做到。

\n

小智 15

您可以使用 kubectl 的端口转发功能来实现此目的。例如,如果您正在运行hello-node服务:

kubectl port-forward svc/hello-node 27017:27017

这会将服务暴露在localhost:27017

您还可以使用相同的命令提及您的 pod 而不是服务,您只需要指定您的pods/pod-name,您可以通过以下方式验证您的 pod 名称kubectl get pods


Ani*_*iki 3

我通过将 minikube 基本驱动程序从 docker 更改为 hyperv 解决了同样的问题。

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Run Code Online (Sandbox Code Playgroud)

之后你的电脑将重新启动,你可以说

minikube config set driver hyperv
Run Code Online (Sandbox Code Playgroud)

然后minikube start将从该驱动程序开始您。

这对我有用。