简体   繁体   English

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

[英]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.

相关问题 无法使用 docker 驱动程序启动 minikube - Unable to start minikube using docker driver 当 minikube 使用 DOCKER vm 驱动程序启动时,从 kubernetes 集群服务访问主机资源 - Access host resources from a kubernetes cluster service when minikube started with DOCKER vm driver 如何从本地机器访问 Docker Desktop - minikube 集群? - How to access Docker Desktop - minikube cluster from local machine? 如何使用 docker 驱动访问 Minikube 中的 NodePort? - How to access NodePort in Minikube with docker driver? 使用带有 --driver=docker 的 minikube 无法从 localhost 转发到 minikube 内部地址 - Using minikube with --driver=docker fails to forward from localhost to minikube internal address 使用 Docker Kubernetes 集群获取 URL 并在没有 Minikube 集群的情况下访问正在运行的服务 - Get URL and access a running service without Minikube Cluster , using a Docker Kubernetes cluster 无法访问 Docker-Driver 上的 Minikube(v1.18.1) Ingress Windows 10 - Could not access Minikube(v1.18.1) Ingress on Docker-Driver Windows 10 如何从 docker 容器连接到 minikube 集群? - How to connect to a minikube cluster from a docker container? 使用没有 minikube 的 docker 文件的 k8s 集群中的部署问题,但我的 pod 没有运行 - Deployment issue in k8s cluster using docker file without minikube, but my is pod not running 使用 docker 驱动程序在 minikube 中的 Docker 本地私有注册表 - Docker local private registry in minikube using the docker driver
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM