卷曲:(7)无法连接到 xx.xx.xx.xx:80;连接被拒绝

curl: (7) Failed connect to xx.xx.xx.xx:80; Connection refused

我正在尝试部署 nginx - ingress

kubectl run nginx --image=nginx

kubectl get pod 
NAME                                       READY     STATUS        RESTARTS   AGE
nginx-65899c769f-wf7dl                     1/1       Running       0          9m


kubectl expose deploy nginx --port 80
NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
nginx        ClusterIP   10.254.75.184      <none>     80/TCP           9m

vi ingress.yml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: nginx
spec:
  rules:
    - host: kub-mst.coral.io
      http:
        paths:
          - backend:
              serviceName: nginx
              servicePort: 80

kubectl get ing
NAME      HOSTS              ADDRESS   PORTS     AGE
nginx     kub-mst                      80        9m

vi /etc/hosts
xx.xx.xx.xx  kub-mst.coral.io

curl kub-mst.coral.io
curl: (7) Failed connect to kub-mst; Connection refused

我有 Kubernetes 集群,正在尝试

curl http://xx.xx.xx.xx

它returns

curl: (7) Failed connect to xx.xx.xx.xx:80; Connection refused

我执行

kubectl cluster-info

它returns

Kubernetes master is running at http://localhost:8080
KubeDNS is running at http://localhost:8080/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

xx.xx.xx.xx 是 public IP。

如何进行故障排除以检测问题出在哪里

您为入口控制器提供了一条匹配您请求的 host header 的规则,但是,出于某种奇怪的原因,您正在测试未提供主机的请求 header.

curl -H 'Host: kub-mst.coral.io' http://xx.xx.xx.xx