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?
Kubernetes: Having same host name but different paths in ingresses in different namespaces in Kubernetes
1k views Asked by devcloud At
2
There are 2 answers
0
On
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: v1
kind: Service
metadata:
labels:
app: my-svc
name: webapp
namespace: default
spec:
externalName: my-svc.my-namespace.svc # <-- put your service name with namespace here
type: ExternalName
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