<p>I'm new to K8s and currently following a course that is using K8s.I am using minikube in my local machine. I'm stuck on the part in which I need to directly communicate with ingress-nginx which happens to be in a separate namespace.</p>
<p>Here's some information regarding my setup.</p>
<pre><code>    ✗ client (main) ✗ kubectl get namespace
    NAME              STATUS   AGE
    default           Active   25d
    ingress-nginx     Active   21d
    kube-node-lease   Active   25d
    kube-public       Active   25d
    kube-system       Active   25d
</code></pre>
<p>Service</p>
<pre><code>    ✔︎ client (main) ✗ kubectl get services -n ingress-nginx
    NAME                                 TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)                      AGE
    ingress-nginx-controller             NodePort    10.105.88.90   &lt;none&gt;        80:30306/TCP,443:31814/TCP   21d
    ingress-nginx-controller-admission   ClusterIP   10.101.75.17   &lt;none&gt;        443/TCP                      21d
</code></pre>
<p>My ingress-srv.yaml file</p>
<pre><code>    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: ingress-service
      annotations:
        kubernetes.io/ingress.class: nginx
        nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
      labels:
        name: ingress-service
    spec:
      rules:
        - host: ticketing.dev
          http:
            paths:
              - pathType: Prefix
                path: &quot;/api/users/(.*)&quot;
                backend:
                  service:
                    name: auth-srv
                    port:
                      number: 3000
              - pathType: Prefix
                path: /?(.*)
                backend:
                  service:
                    name: client-srv
                    port:
                      number: 3000
</code></pre>
<p>I looked for some information over <a href="https://github.com/kubernetes/ingress-nginx/issues/3665" rel="nofollow noreferrer">github</a> and to do cross communication what I need to do is doing <code>http://&lt;service&gt;.&lt;namespace&gt;.svc.cluster.local:&lt;port&gt;/</code>. Based on that info, I came up with
<code>http://ingress-nginx-controller.ingress-nginx.svc.cluster.local</code> and test it using curl.</p>
<pre><code>✔︎ client (main) ✗ curl http://ingress-nginx-controller.ingress-nginx.svc.cluster.local
curl: (6) Could not resolve host: ingress-nginx-controller.ingress-nginx.svc.cluster.local
</code></pre>
<p>I'm following a course called <a href="https://www.udemy.com/course/microservices-with-node-js-and-react/" rel="nofollow noreferrer"> Microservices with Node JS and React </a></p>
<p>Hope for your answers and insights.
Thank you.</p>

<p>If you ingress controller in Ingress-nginx namespace it perfect or also fine it's any other namespace.</p>
<p>You have create the ingress object in that namespace where your application running, regardless of where you controller running.</p>
<p>Ingress will find the controller or communicate with it across namespace automatically using the class that you have specified in the <strong>ingress</strong> object.</p>
<p>In simple words</p>
<p>If your <strong>app1</strong> running in namespace <strong>application</strong> just create one <strong>ingress</strong> in <strong>application</strong> namespace pointing to <strong>app1</strong> <em>service</em> and you are done.</p>
<pre><code>apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: ingress-service
      annotations:
        kubernetes.io/ingress.class: nginx
        nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
      labels:
        name: ingress-service
    spec:
      rules:
        - host: ticketing.dev
          http:
            paths:
              - pathType: Prefix
                path: &quot;/api/users/(.*)&quot;
                backend:
                  service:
                    name: auth-srv
                    port:
                      number: 3000
              - pathType: Prefix
                path: /?(.*)
                backend:
                  service:
                    name: client-srv
                    port:
                      number: 3000
</code></pre>
<ul>
<li>Ingress Controller(simple Pod/Deployment along with a Service that can be used to utilize routing and proxying. Based on Nginx example);</li>
<li>Ingress rules(a separate Kubernetes resource with <strong>kind: Ingress</strong>. Will only take effect if Ingress Controller is already existing and <strong>class</strong> is mentioned in ingress)</li>
</ul>
<p>Ingress Controller can be deployed in any namespace, usually deployed in a namespace separate from your app services like you have done in <strong>ingress-nginx</strong>. It can out-of-the-box see Ingress rules in all namespaces in the cluster and will pick them up.</p>
<p>The Ingress rules, however, must reside in the namespace where the app that they configure reside.</p>
