<p>I have a situation where multiple Kubernetes namespaces have been configured to use one ingress host. And the requests to K8s ingress controller will come from a load balancer F5.</p>
<p>If a user sends a request to example.com/api/service1, that request will land on the F5 and the F5 will route it to worker nodes without changing the URLs. The K8s ingress needs to route the requests to different namespaces but as I mentioned all namespaces are using the same ingress (example.com).</p>
<p>My concern is how the K8s ingress will forward the requests to the appropriate namespace? Any thought? Thanks in advance.</p>

<p>The support for something like this was <a href="https://github.com/kubernetes/kubernetes/issues/17088" rel="nofollow noreferrer">decided against</a> a while ago due to security reasons. However, as indicated in the issue the workaround is to create a service with no labels in the namespace where your ingress is defined and then manually add the IP address of the services on the other namespace as the endpoint.</p>
<p>Another workaround would be to use <a href="https://devcentral.f5.com/s/articles/the-three-http-routing-patterns-you-should-know-30764" rel="nofollow noreferrer">path-based</a> routing in your F5. Then have 2 (or more) ingress controllers with different <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-class" rel="nofollow noreferrer">ingress classes</a>. Each of these ingress controllers could be exposed using a <a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport" rel="nofollow noreferrer">NodePort</a> service and then you could do the path-based routing from the F5 to either NodePort service depending on the incoming L7 path.</p>
<p>There may be other possible combinations using an <a href="https://clouddocs.f5.com/containers/v2/kubernetes/kctlr-k8s-ingress-ctlr.html" rel="nofollow noreferrer">actual BIG-IP F5 ingress controller</a>.</p>
