Apple M1 minikube 无服务 URL

发布于 2025-01-18 01:56:26 字数 347 浏览 1 评论 0原文

我正在开发 Apple Silicon M1 Max,并尝试通过 Web 浏览器访问服务,但是 minikube service nginx 打开带有某些地址的空白 Web 浏览器选项卡(例如 http:// 192.168.49.2:31542/) 无法加载。在下面的日志中,您可以注意到 minikube service list 的输出在 URL 列中没有 URL。命令 minikube service nginx --url 也不会返回任何 URL。

$ minikube start --driver=docker

              

I'm working on Apple Silicon M1 Max and I'm trying to access service through web browser, but minikube service nginx opens blank web browser tab with some address (for example http://192.168.49.2:31542/) which fails to load. In log below you can notice output from minikube service list has no URL in URL column. Command minikube service nginx --url does not return any URL as well.

$ minikube start --driver=docker
????  minikube v1.25.2 on Darwin 12.3 (arm64)
    ▪ MINIKUBE_ACTIVE_DOCKERD=minikube
✨  Using the docker driver based on user configuration
????  Starting control plane node minikube in cluster minikube
????  Pulling base image ...
????  Downloading Kubernetes v1.23.3 preload ...
    > preloaded-images-k8s-v17-v1...: 419.07 MiB / 419.07 MiB  100.00% 22.15 Mi
????  Creating docker container (CPUs=2, Memory=7903MB) ...
????  Preparing Kubernetes v1.23.3 on Docker 20.10.12 ...
    ▪ kubelet.housekeeping-interval=5m
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
????  Verifying Kubernetes components...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
????  Enabled addons: storage-provisioner, default-storageclass
????  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

 $ kubectl create deployment nginx --image=nginx && kubectl create service nodeport nginx --tcp=80:80
deployment.apps/nginx created
service/nginx created

 $ kubectl get service
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP   10.96.0.1        <none>        443/TCP        12m
nginx        NodePort    10.104.191.210   <none>        80:31542/TCP   12m

 $ minikube service list
|-------------|------------|--------------|-----|
|  NAMESPACE  |    NAME    | TARGET PORT  | URL |
|-------------|------------|--------------|-----|
| default     | kubernetes | No node port |
| default     | nginx      | 80-80/80     |     |
| kube-system | kube-dns   | No node port |
|-------------|------------|--------------|-----|

$ minikube service nginx --url

????  Starting tunnel for service nginx.
❗  Because you are using a Docker driver on darwin, the terminal needs to be open to run it.

Any ideas why there is no service URL and I am not able to access service from web browser?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏天碎花小短裙 2025-01-25 01:56:26

如果在 Darwin、Windows 或 WSL 上使用 Docker 驱动程序,网络会受到限制,并且无法直接访问节点 IP。

运行服务隧道

minikube service nginx

在另一个终端中检查 ssh 隧道

$ ps -ef | grep [email protected]
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -N [email protected] -p 55972 -i /Users/FOO/.minikube/machines/minikube/id_rsa -L TUNNEL_PORT:CLUSTER_IP:TARGET_PORT

在浏览器中打开

http://127.0.0.1:TUNNEL_PORT

参考:
https://minikube.sigs.k8s .io/docs/handbook/accessing/#using-minikube-service-with-tunnel

The network is limited if using the Docker driver on Darwin, Windows, or WSL, and the Node IP is not reachable directly.

Run service tunnel

minikube service nginx

Check ssh tunnel in another terminal

$ ps -ef | grep [email protected]
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -N [email protected] -p 55972 -i /Users/FOO/.minikube/machines/minikube/id_rsa -L TUNNEL_PORT:CLUSTER_IP:TARGET_PORT

Open in your browser

http://127.0.0.1:TUNNEL_PORT

ref:
https://minikube.sigs.k8s.io/docs/handbook/accessing/#using-minikube-service-with-tunnel

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文