kubernetes 的外部 ip 在 minikube 中显示 <nodes>

External ip for kubernetes shows <nodes> in minikube

我是 Kubernetes 的新手,我最近使用 NodePort 类型公开了一个使用 miniKube 的服务。我想测试我的应用程序的 运行 但我没有看到任何外部 ip,只有端口。这是我的输出:

$kubectl get service
NAME                  CLUSTER-IP   EXTERNAL-IP   PORT(S)          AGE
kubernetes            10.0.0.1     <none>        443/TCP          1h
kubernetes-bootcamp   10.0.0.253   <nodes>       8080:31180/TCP   20m


$kubectl describe services/kubernetes-bootcamp
Name:           kubernetes-bootcamp
Namespace:      default
Labels:         run=kubernetes-bootcamp
Annotations:        <none>
Selector:       run=kubernetes-bootcamp
Type:           NodePort
IP:         10.0.0.253
Port:           <unset> 8080/TCP
NodePort:       <unset> 31180/TCP
Endpoints:      172.17.0.2:8080
Session Affinity:   None
Events:         <none>

在这种情况下,External IP 是什么,以便我可以使用 curl 来公开我的应用程序的输出,我在笔记本电脑上工作时遵循了教程:https://kubernetes.io/docs/tutorials/kubernetes-basics/expose-interactive/ .

P.S :<nodes>External-IP 下的 get service 命令的输出中意味着什么?

当您使用 minikube 时,命令 minikube ip 将 return 您正在寻找的 IP。

如果您不使用 minikubekubectl get nodes -o yaml 将向您显示节点的 IP 地址等数据。