Kubernetes service and namespaces

Hi there,

I'm struggling to find out how to specify a different kubernetes namespace within a ingressroute.

For example I have a k8s service 'ping' in the namespace 'test' and want to reference this from an ingressroute in a namespace called 'app'.

I have tried the normal k8s style ping.test but this errors

Any hints?:slight_smile:


Hi @Craig.millard, as suggested in the official Kubernetes project tracker: https://github.com/kubernetes/kubernetes/issues/17088 , this is something not available by design with Ingresses.

With the IngressRoute, we are following this behaviour as well, because it's related to Kubernetes internals (and security).

What is the reason that make you store IngressRoute object in a different namespace than the Service object?

As an (heavy) alternative, you can create a "fake" service of type externalName, in the same namespace as the Ingressroute. Then, set the externalDNS name to the service you want to reach in the form <service>.<namespace>.<cluster doamin> (see https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#services for more informations).

1 Like