这些是我的豆荚
hello-kubernetes-5569fb7d8f-4rkhs 0/1 ImagePullBackOff 0 5d2h hello-minikube-5857d96c67-44kfg 1/1 Running 1 5d2h hello-minikube2 1/1 Running 0 3m24s hello-minikube2-74654c8f6f-trrrw 1/1 Running 0 4m8s hello-newkubernetes 0/1 ImagePullBackOff 0 5d1h如果我尝试
curl $(minikube service hello-minikube2 --url) curl: (7) Failed to connect to 192.168.99.100 port 31591: Connection refused让我们检查一下VBox
Let's check VBox
inet 192.168.99.1/24 brd 192.168.99.255 scope global vboxnet0 valid_lft forever preferred_lft forever inet6 fe80::800:27ff:fe00:0/64 scope link valid_lft forever preferred_lft forever为什么我的连接被拒绝?
Why is my connection refused?
kubectl get svc -o wide NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR hello-kubernetes NodePort 10.98.65.138 <none> 8080:30062/TCP 5d2h run=hello-kubernetes hello-minikube NodePort 10.105.166.56 <none> 8080:30153/TCP 5d3h run=hello-minikube hello-minikube2 NodePort 10.96.94.39 <none> 8080:31591/TCP 42m run=hello-minikube2 kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 5d4h <none> tomcat-deployment NodePort 10.96.205.228 <none> 8080:30613/TCP 2m13s app=tomcat kubectl get ep -o wide NAME ENDPOINTS AGE hello-kubernetes 5d14h hello-minikube 172.17.0.7:8080 5d14h hello-minikube2 172.17.0.4:8080,172.17.0.5:8080 12h kubernetes 192.168.99.100:8443 5d16h tomcat-deployment 172.17.0.6:8080 11h我想显示服务端点
minikube service tomcat-deployment --url 192.168.99.100:30613为什么该网址与get ep -o wide输出不同?
Why is this url different from get ep -o wide output?
推荐答案显然,您正在尝试在群集外部访问服务,因此您需要公开服务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更多推荐
curl:(7)无法连接到192.168.99.100端口31591:连接被拒绝
发布评论