Ingress-nginx: Ingress nginx 80 port not work but 443 works fine with hostNetwork mode.

Created on 3 Sep 2019  路  1Comment  路  Source: kubernetes/ingress-nginx

Today I use kubeadm to setup k8s environment, Everything is going to be fine, but when I setup nginx ingress load balancer with hostNetwork mode, it orrcurs a problem that 80 port not work but 443 work fine.
I just download the configuration file with the link( https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.25.1/deploy/static/mandatory.yaml), apply it for the 2 nodes which node is labeled as ingress node.

k8s master show the information about Ingress NGINX

Init k8s master

[root@test-k8s-master-1 ~]# kubeadm init --pod-network-cidr=10.244.0.0/16 --service-cidr=10.96.0.0/12

Omit installation steps for k8s nodes.
then after applying the file of ingress-nginx, the information as following below

ingress-nginx pod information

[root@test-k8s-master-1 ~]# kubectl get pods  -n ingress-nginx -o wide
NAME                                        READY   STATUS    RESTARTS   AGE   IP           NODE                          NOMINATED NODE   READINESS GATES
nginx-ingress-controller-7f8d586b6b-6jk6s   1/1     Running   0          28m   10.0.10.37   test-k8s-node-1.189read.com   <none>           <none>
nginx-ingress-controller-7f8d586b6b-zlbpm   1/1     Running   0          28m   10.0.10.38   test-k8s-node-2.189read.com   <none>           <none>

ingress-nginx svc information

[root@test-k8s-master-1 ~]# kubectl get svc -n ingress-nginx  -o wide             
NAME            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE   SELECTOR
ingress-nginx   ClusterIP   10.100.150.89   <none>        80/TCP,443/TCP   3s    app.kubernetes.io/name=ingress-nginx,app.kubernetes.io/part-of=ingress-nginx

Ingress POD TCP link as following bellow:

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      32039/nginx: master 
tcp        0      0 127.0.0.1:45375         0.0.0.0:*               LISTEN      29620/kubelet       
tcp        0      0 0.0.0.0:18822           0.0.0.0:*               LISTEN      943/sshd            
tcp        0      0 127.0.0.1:10248         0.0.0.0:*               LISTEN      29620/kubelet       
tcp        0      0 127.0.0.1:10249         0.0.0.0:*               LISTEN      30907/kube-proxy    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      32039/nginx: master 
tcp        0      0 0.0.0.0:8181            0.0.0.0:*               LISTEN      32039/nginx: master 
tcp        0      0 10.0.10.37:47820        10.96.0.1:443           ESTABLISHED 31967/nginx-ingress 
tcp        0      0 10.0.10.37:45152        10.96.0.1:443           ESTABLISHED 30733/flanneld      
tcp        0      0 10.0.10.37:46538        10.0.10.36:6443         ESTABLISHED 30907/kube-proxy    
tcp        0      0 10.0.10.37:48884        10.0.10.36:6443         ESTABLISHED 29620/kubelet       
tcp6       0      0 :::443                  :::*                    LISTEN      32039/nginx: master 
tcp6       0      0 :::18822                :::*                    LISTEN      943/sshd            
tcp6       0      0 :::10250                :::*                    LISTEN      29620/kubelet       
tcp6       0      0 :::10254                :::*                    LISTEN      31967/nginx-ingress 
tcp6       0      0 :::10256                :::*                    LISTEN      30907/kube-proxy    
tcp6       0      0 :::80                   :::*                    LISTEN      32039/nginx: master 
tcp6       0      0 :::8181                 :::*                    LISTEN      32039/nginx: master    

telnet Services ClusterIP ports

[root@test-k8s-master-1 ~]# telnet 10.100.150.89 80
Trying 10.100.150.89...
[root@test-k8s-master-1 ~]# telnet 10.100.150.89 443
Trying 10.100.150.89...
Connected to 10.100.150.89.
Escape character is '^]'.
^CConnection closed by foreign host.

why is the 80 port bad? how to solve this problem?
thanks

>All comments

Please use the #ingress-nginx slack channel to ask this kind of questions. Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sophaskins picture sophaskins  路  3Comments

lachlancooper picture lachlancooper  路  3Comments

natemurthy picture natemurthy  路  3Comments

cehoffman picture cehoffman  路  3Comments

jwfang picture jwfang  路  3Comments