<p>I encountered a problem when integrating K8S nginx ingress. I installed the nginx ingress controller and established the testing ingress resources according to the instructions on the document, but I was not able to jump to the normal path. The test serive was normal and Accessible via cluster IP. Am I missing something?</p>

<blockquote>
  <p>Install script</p>
</blockquote>

<pre><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml
</code></pre>

<blockquote>
  <p>Bare-metal Using NodePort</p>
</blockquote>

<pre><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/baremetal/service-nodeport.yaml
</code></pre>

<p><strong>Ingress controller is OK</strong> 
<a href="https://i.stack.imgur.com/0vmLv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0vmLv.png" alt="enter image description here"></a></p>

<blockquote>
  <p>Testing ingress resource</p>
</blockquote>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx
spec:
  selector:
    matchLabels:
      app: my-nginx
  template:
    metadata:
      labels:
        app: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx:latest
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: my-nginx
  labels:
    app: my-nginx
spec:
  ports:
  - port: 80
    protocol: TCP
    name: http
  selector:
    app: my-nginx
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-nginx
  annotations:
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
  - host: nginx1.beencoding.com
    http:
      paths:
      - path: /
        backend:
          serviceName: nginx-1
          servicePort: 80

</code></pre>

<p><strong>We can see the test nginx pod raised and works fine, I can access the nginx index page by cluster IP</strong>
<a href="https://i.stack.imgur.com/I6Vf4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I6Vf4.png" alt="enter image description here"></a></p>

<p><strong>But I can't access nginx1.beencoding.com</strong>
<a href="https://i.stack.imgur.com/g1dce.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/g1dce.png" alt="enter image description here"></a></p>

<p><strong>Can't access via browser</strong>
<a href="https://i.stack.imgur.com/GvD8C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GvD8C.png" alt="enter image description here"></a></p>

<p>I have solved the problem by setting <code>hostnetwork: true</code></p>
