无法用minikube连接到NodePort URL



我只是在尝试一个非常简单的NodePort示例,在Apple M1机器上使用minikube。我基本上通过minikube创建了一个单节点k8s集群,然后创建一个1-pod部署和NodePort服务。NodePort URL一直在为我加载。下面是我使用的命令:

$ minikube start
😄  minikube v1.25.2 on Darwin 12.4 (arm64)
✨  Automatically selected the docker driver
👍  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% 5.49 MiB
🔥  Creating docker container (CPUs=2, Memory=4000MB) ...
🐳  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-deployment --image=nginxdemos/hello
deployment.apps/nginx-deployment created

$ kubectl expose deployment nginx-deployment --type=NodePort --port=80
service/nginx-deployment exposed

$ minikube service nginx-deployment
🏃  Starting tunnel for service nginx-deployment.
🎉  Opening service default/nginx-deployment in default browser...
❗  Because you are using a Docker driver on darwin, the terminal needs to be open to run it.
=> This opens the URL in the browser (e.g. http://192.168.49.2:32739/), but it keeps loading forever

当我SSH到节点时,我可以毫无问题地卷曲pod IP。

$ minikube ssh
Last login: Thu May 26 10:09:35 2022 from 192.168.49.1
# This is the IP of the running pod
docker@minikube:~$ curl -sI 172.17.0.3 | grep HTTP
HTTP/1.1 200 OK

我还看到服务绑定到pod:

$ kubectl describe service nginx-deployment
Name:                     nginx-deployment
Namespace:                default
Labels:                   app=nginx-deployment
Annotations:              <none>
Selector:                 app=nginx-deployment
Type:                     NodePort
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.109.174.147
IPs:                      10.109.174.147
Port:                     <unset>  80/TCP
TargetPort:               80/TCP
NodePort:                 <unset>  32739/TCP
Endpoints:                172.17.0.3:80
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

我做错了什么?

我通过切换到使用Docker Desktop kubernetes解决了这个问题。看来minikube在Apple M1上运行得不太好。

相关内容

  • 没有找到相关文章