curl:(7)无法连接到192.168.99.100端口31591:连接被拒绝

编程入门 行业动态 更新时间:2024-10-28 06:27:11
本文介绍了curl:(7)无法连接到192.168.99.100端口31591:连接被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这些是我的豆荚

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:连接被拒绝

本文发布于:2023-06-05 01:14:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/508837.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:连接到   端口   被拒   curl

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!