【问题标题】:Connected refused when trying to hit kubernetes nodeport service using minikube in win10尝试在 win10 中使用 minikube 访问 kubernetes nodeport 服务时连接被拒绝
【发布时间】:2019-11-09 14:11:00
【问题描述】:

我在 windows 10 的 minikube 上部署了一个非常简单的 springboot 服务。

C:\Software\Kubernetes>kubectl 获取部署

NAME                 READY   UP-TO-DATE   AVAILABLE   AGE
myspringbootserver   1/1     1            1           68m

C:\Software\Kubernetes>kubectl 获取服务

NAME                 TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
kubernetes           ClusterIP   10.96.0.1        <none>        443/TCP          49d
myspringbootserver   NodePort    10.110.179.207   <none>        9080:30451/TCP   6m50s

C:\Software\Kubernetes>minikube 服务 myspringbootserver --url

http://192.168.99.101:30451

但是当我尝试从我的 chrome 浏览器中使用 url 访问服务时

http://192.168.99.101:30451/MySpringBootServer/heartbeat

获取连接被拒绝异常。不知道出了什么问题。有人可以帮忙解决吗?

enter image description here

【问题讨论】:

  • 你能连接到http://192.168.99.101:30451吗?

标签: kubernetes minikube


【解决方案1】:

你能curlwget使用pod的IP地址吗?

例如kubectl exec -it podname -- curl http://podip:9080/MySpringBootServer/heartbeat

如果不是,请确保路径正确

如果是,请确保 pod 作为服务的端点存在

kubectl get endpoints myspringbootserver

这里有一个关于服务的很好的调试文档:

https://kubernetes.io/docs/tasks/debug-application-cluster/debug-application/#debugging-services

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-12
    • 2020-11-06
    • 2019-05-06
    • 1970-01-01
    • 1970-01-01
    • 2021-01-20
    • 1970-01-01
    • 2021-07-08
    相关资源
    最近更新 更多