我正在尝试部署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。
如何进行故障排除以检测出问题所在
答案 0 :(得分:2)
您为入口控制器提供了一个与请求的 host 标头相匹配的规则,但是由于某种奇怪的原因,您正在测试的请求不提供主机标头。
curl -H 'Host: kub-mst.coral.io' http://xx.xx.xx.xx