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

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


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 configurationfor a common host across multiple Ingress resources using MergeableIngress resources. Such resources can belong to the same or differentnamespaces. This enables easier management when using a large numberof paths. See the Mergeable Ingress Resources example on our GitHub.

As an alternative to Mergeable Ingress resources, you can useVirtualServer and VirtualServerRoute resources for cross-namespaceconfiguration. See the Cross-Namespace Configuration example on ourGitHub.


If you do not want to change your default ingress controller (nginx-ingress), another option is to define a service of type ExternalName in your default namespace that points to the full internal service name of the service in the other namespace.

Something like this:

apiVersion: v1kind: Servicemetadata:  labels:    app: my-svc  name: webapp  namespace: defaultspec:  externalName: my-svc.my-namespace.svc # <-- put your service name with namespace here  type: ExternalName