簡體   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.)

我試圖從瀏覽器訪問一個簡單的 minikube 集群,但我不斷收到以下信息: ❗ Because you are using a Docker driver on windows, the terminal needs to be open to run it.

我為集群創建了一個端口號為 30384 的外部服務,我在 docker 容器中運行 minikube。

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

第一步:我創建了部署:

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

第二步:我創建了外部服務: kubectl expose deployment hello-node --type=LoadBalancer --port=8080

第 3 步:我運行了服務,那是我填充“ minikube service hello-node ”的地方

完整的返回信息:

❗ 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.

我試圖運行該服務以使其可以從瀏覽器訪問,但是我做不到。

您可以使用 kubectl 的端口轉發功能來完成這項工作。 例如,如果您正在運行hello-node服務:

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

這將在localhost:27017上公開服務

您也可以使用相同的命令提及您的 pod 而不是服務,您只需要指定您的pods/pod-name ,您可以通過kubectl get pods驗證您的 pod 名稱

我通過將 minikube 基本驅動程序從 docker 更改為 hyperv 解決了同樣的問題。

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

之后您的電腦將重新啟動,您可以說

minikube config set driver hyperv

然后minikube start將使用該驅動程序啟動您。

這對我有用。

你可以在 minikube 教程中找到替代方法,這個在 windows 上對我有用:

kubectl port-forward service/hello-minikube 7080:8080

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-

嘗試使用:

minikube 服務——全部

它在瀏覽器實例中顯示並打開服務沒有問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM