我正在尝试部署nginx - 入口
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
它返回
curl: (7) Failed connect to xx.xx.xx.xx:80; Connection refused
我执行
kubectl cluster-info
它返回
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是公共IP。
如何进行故障排除以检测问题所在
您为入口控制器提供了与请求的主机标头匹配的单个规则,但是,出于某种奇怪的原因,您正在使用未提供主机标头的请求进行测试。
curl -H 'Host: kub-mst.coral.io' http://xx.xx.xx.xx