<p>in my k8s system I have a nginx ingress controller as LoadBalancer and accessing it to ddns adress like hedehodo.ddns.net and this triggering to forward web traffic to another nginx port.
Now I deployed another nginx which works on node.js app but I cannot forward nginx ingress controller for any request to port 3000 to go another nginx</p>
<p>here is the nginx ingress controller yaml</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  namespace: default
spec:
  rules:
  - host: hedehodo.ddns.net
    http:
      paths:
      - path: /
        backend:
          serviceName: my-nginx
          servicePort: 80
      - path: /
        backend:
          serviceName: helloapp-deployment
          servicePort: 3000
</code></pre>
<p>helloapp deployment works a Loadbalancer and I can access it from IP:3000</p>
<p>could any body help me?</p>

<p>Each host cannot share multiple duplicate paths, so in your example, the request to host: <code>hedehodo.ddns.net</code> will always map to the first service listed: <code>my-nginx:80</code>.</p>
<p>To use another service, you have to specify a different path. That path can use any service that you want. Your ingress should always point to a service, and that service can point to a deployment.</p>
<p>You should also use HTTPS by default for your ingress.</p>
<p>Ingress example:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: test-ingress
spec:
  rules:
    - host: my.example.net
      http:
        paths:
          - path: /
            backend:
              serviceName: my-nginx
              servicePort: 80
          - path: /hello
            backend:
              serviceName: helloapp-svc
              servicePort: 3000
</code></pre>
<p>Service example:</p>
<pre class="lang-yaml prettyprint-override"><code>---
apiVersion: v1
kind: Service
metadata:
  name: helloapp-svc
spec:
  ports:
    - port: 3000
      name: app
      protocol: TCP
      targetPort: 3000
  selector:
    app: helloapp
  type: NodePort
</code></pre>
<p>Deployment example:</p>
<pre class="lang-yaml prettyprint-override"><code>---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: helloapp
  labels:
    app: helloapp
spec:
  replicas: 1
  selector:
    matchLabels:
      app: helloapp
  template:
    metadata:
      labels:
        app: helloapp
    spec:
      containers:
        - name: node
          image: my-node-img:v1
          ports:
            - name: web
              containerPort: 3000
</code></pre>
