Multiple Kubernetes namespace and single ingress host

7/6/2020

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.

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).

My concern is how the K8s ingress will forward the requests to the appropriate namespace? Any thought? Thanks in advance.

-- pijushcse
f5
kubernetes
kubernetes-ingress

1 Answer

7/6/2020

The support for something like this was decided against 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.

Another workaround would be to use path-based routing in your F5. Then have 2 (or more) ingress controllers with different ingress classes. Each of these ingress controllers could be exposed using a NodePort service and then you could do the path-based routing from the F5 to either NodePort service depending on the incoming L7 path.

There may be other possible combinations using an actual BIG-IP F5 ingress controller.

-- Rico
Source: StackOverflow