<p>Now I am using treafik to expose my pods service to external,but I read the treafik deploy document and find out treafik forward request only in one namespace.For example, A namespaces request could not forward to B namespace ,should I deploy multi-treafik in kubernetes cluster?Now I have 6 namespace,should I deploy 6 treafik? It is wired, what is the best practice about this situation? I found from internet but find nothing talking about this.</p>

<p>If I understand you correctly this is unfortunately not possible and it was a conscious decision to do it that way:</p>

<blockquote>
  <p>Cross namespace references would be a prime source of privilege
  escalation attacks.</p>
</blockquote>

<p>But in case you don't care about security rules there is a workaround (bear in mind that it will not work on every platform). You need to use Kubernetes services of type <code>externalName</code>, which would reference the services from your other namespaces. See the example below:</p>

<p>a. you have <code>serviceA</code> in <code>namespaceA</code></p>

<p>b. create <code>serviceB</code> in <code>namespaceB</code></p>

<pre><code>spec:
    ...
    type: ExertalName
    externalName: serviceA.namespaceA.svc.cluster.local
</code></pre>

<p>c. add ingress rule into <code>ingressB</code> in <code>namespaceB</code></p>

<pre><code> - path: /****
    backend:
      serviceName: serviceB
      servicePort: ***
</code></pre>

<p>However it would be safer if you just deploy multiple ingress treafiks for each namespace.</p>

<p>I hope it helps. </p>
