前提,本地VMware 搭建了一master两node节点的集群
master:192.168.89.100
node3:192.168.89.103
node4:192.168.89.104
一.
按照官网提供的yaml安装nginx-ingress-controller,
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.1/deploy/static/provider/cloud/deploy.yaml
二.
查看 ingress-nginx名称空间的pod

三.
创建deploy,svc,ingress
创建deploy

创建svc,并访问

创建ingress

四.
在本地电脑C:\Windows\System32\drivers\etc\hosts配置192.168.89.100 demo.localdev.me(模仿dns解析)
五.
本地浏览器访问,结果报错
六.
查询很多资料也不知道为啥,后面在群里咨询了@sam大佬
发现ingress-nginx的svc中的ingress-nginx-controller,EXTERNAL-IP为空,集群外无法访问
七.
修改ingress-nginx-controller,在如下位置添加EXTERNAL-IP
kubectl edit -n ingress-nginx service/ingress-nginx-controller
EXTERNAL-IP已经存在
再次访问,还是不行
八.
经sam大佬提醒,EXTERNAL-IP需要填写ingress-nginx-controller安装机器的ip,而不是master的ip
pod是安装在node4节点
修改EXTERNAL-IP为node4的ip
kubectl edit -n ingress-nginx service/ingress-nginx-controller
修改hosts
九.
终于访问成功
发个帖子记录一下这个坑
疑问点:
为啥官方提供的nginx-ingress-controller的yaml安装会没有指定EXTERNAL-IP呢?