Search code examples
kuberneteskubernetes-ingresskubernetes-namespace

Kubernetes: Having same host name but different paths in ingresses in different namespaces in Kubernetes


I want to use the same hostname e.g. example.com in two different namespaces with different paths. e.g. in namespace A I want example.com/clientA and in namespace B I want example.com/clientB. Any ideas on how to achieve this?


Solution

  • nginxinc has Cross-Namespace Configuration feature that allows you do exactly what you described. You can also find there prepared examples with deployments, services, etc.

    The only thing you most probably wont like..nginxinc is not free..

    Also look here

    Cross-namespace Configuration You can spread the Ingress configuration for a common host across multiple Ingress resources using Mergeable Ingress resources. Such resources can belong to the same or different namespaces. This enables easier management when using a large number of paths. See the Mergeable Ingress Resources example on our GitHub.

    As an alternative to Mergeable Ingress resources, you can use VirtualServer and VirtualServerRoute resources for cross-namespace configuration. See the Cross-Namespace Configuration example on our GitHub.