更新时间:2021-12-13 22:37:22
显然,您正在尝试在群集外部访问服务,因此您需要公开服务IP以进行外部连接.
Apparently, you are trying to reach your service outside of the cluster, thus you need to expose your service IP for external connection.
运行kubectl edit svc hello-minikube2
并更改
type: NodePort
到
type: LoadBalancer
或
kubectl expose deployment hello-minikube2 --type=LoadBalancer --port=8080
在支持负载平衡器的云提供商上,将提供一个外部IP地址来访问服务.在Minikube上,LoadBalancer类型使服务可以通过minikube service命令访问.
On cloud providers that support load balancers, an external IP address would be provisioned to access the Service. On Minikube, the LoadBalancer type makes the Service accessible through the minikube service command.
运行以下命令:
minikube service hello-minikube2