[英]Unable to access my minikube cluster from the browser (❗ Because you are using a Docker driver on windows, the terminal needs to be open to run it.)
I am trying to access a simple minikube cluster from the browser, but I keep getting the following: ❗ Because you are using a Docker driver on windows, the terminal needs to be open to run it.
我试图从浏览器访问一个简单的 minikube 集群,但我不断收到以下信息:
❗ Because you are using a Docker driver on windows, the terminal needs to be open to run it.
I've created an external service for the cluster with the port number of 30384, and I'm running minikube in a docker container.我为集群创建了一个端口号为 30384 的外部服务,我在 docker 容器中运行 minikube。
I'm follwing "Hello Minikube" example to create my deployment.我正在按照“Hello Minikube”示例来创建我的部署。
Step1: I created the deployment:第一步:我创建了部署:
kubectl create deployment hello-node --image=k8s.gcr.io/echoserver:1.4
Step2: I created the external service: kubectl expose deployment hello-node --type=LoadBalancer --port=8080
第二步:我创建了外部服务:
kubectl expose deployment hello-node --type=LoadBalancer --port=8080
Step3: I ran the service, and that;s where I stuffed up " minikube service hello-node
第 3 步:我运行了服务,那是我填充“
minikube service hello-node
”的地方
The full return message:完整的返回信息:
❗ Executing "docker container inspect minikube --format={{.State.Status}}" took an unusually long time: 2.3796077s
Restarting the docker service may improve performance.
❗ Executing "docker container inspect minikube --format={{.State.Status}}" took an unusually long time: 2.3796077s
Restarting the docker service may improve performance.
Starting tunnel for service hello-node.
Opening service default/hello-node in default browser...
❗ Because you are using a Docker driver on windows, the terminal needs to be open to run it.
Opening service default/hello-node in default browser...
❗ Because you are using a Docker driver on windows, the terminal needs to be open to run it.
I tried to run the service to make it accessible from the browser, however, I wasn't able to.我试图运行该服务以使其可以从浏览器访问,但是我做不到。
You can get this working by using kubectl's port forwarding capability.您可以使用 kubectl 的端口转发功能来完成这项工作。 For example, if you are running
hello-node
service:例如,如果您正在运行
hello-node
服务:
kubectl port-forward svc/hello-node 27017:27017
This would expose the service on localhost:27017
这将在
localhost:27017
上公开服务
You can also mention your pod instead of the service with the same command, you just need to specify your pods/pod-name
, you can verify your pod name by kubectl get pods
您也可以使用相同的命令提及您的 pod 而不是服务,您只需要指定您的
pods/pod-name
,您可以通过kubectl get pods
验证您的 pod 名称
I got the same issue resolved it by changing minikube base driver to hyperv from docker.我通过将 minikube 基本驱动程序从 docker 更改为 hyperv 解决了同样的问题。
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Your pc will restart after that you can say之后您的电脑将重新启动,您可以说
minikube config set driver hyperv
Then minikube start
will start you with that driver.然后
minikube start
将使用该驱动程序启动您。
This worked for me.这对我有用。
You can find the alternative in the minikube tutorial, this one works for me on windos:你可以在 minikube 教程中找到替代方法,这个在 windows 上对我有用:
kubectl port-forward service/hello-minikube 7080:8080
http://localhost:7080/ response: http://localhost:7080/ 响应:
CLIENT VALUES:
client_address=127.0.0.1
command=GET
real path=/
query=nil
request_version=1.1
request_uri=http://localhost:8080/
SERVER VALUES:
server_version=nginx: 1.10.0 - lua: 10001
HEADERS RECEIVED:
accept=text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
accept-encoding=gzip, deflate, br
accept-language=es-US,es-419;q=0.9,es;q=0.8,en;q=0.7
connection=keep-alive
host=localhost:7080
sec-ch-ua=" Not A;Brand";v="99", "Chromium";v="102", "Google Chrome";v="102"
sec-ch-ua-mobile=?0
sec-ch-ua-platform="Windows"
sec-fetch-dest=document
sec-fetch-mode=navigate
sec-fetch-site=cross-site
sec-fetch-user=?1
upgrade-insecure-requests=1
user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
BODY:
-no body in request-
try to use:尝试使用:
minikube service --all minikube 服务——全部
it shows and opens the service in browser instance without issue.它在浏览器实例中显示并打开服务没有问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.