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.
我已经为集群创建了一个外部服务,端口号为 30384,并且我在 docker 容器中运行 minikube。
\n我正在按照“Hello Minikube”示例来创建我的部署。
\n第 1 步:我创建了部署:
\nkubectl create deployment hello-node --image=k8s.gcr.io/echoserver:1.4
第 2 步:我创建了外部服务:\nkubectl expose deployment hello-node --type=LoadBalancer --port=8080
第三步:我运行了该服务,这就是我塞满的地方\n”minikube service hello-node
完整的返回消息:
\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小智 15
您可以使用 kubectl 的端口转发功能来实现此目的。例如,如果您正在运行hello-node服务:
kubectl port-forward svc/hello-node 27017:27017
这会将服务暴露在localhost:27017
您还可以使用相同的命令提及您的 pod 而不是服务,您只需要指定您的pods/pod-name,您可以通过以下方式验证您的 pod 名称kubectl get pods
我通过将 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将从该驱动程序开始您。
这对我有用。
| 归档时间: |
|
| 查看次数: |
12172 次 |
| 最近记录: |