kubernetes : Service shared between multiple namespaces

9/21/2015

I'm searching for the answer but i didn't find it anywhere. Is it possible to share a service between multiple namespaces ?

For instance, if i have 2 namespaces (let's say 'qa' and 'dev'), is it possible to use the same database server ? The database server would be preferably managed by kubernetes too.

I've read this issue : https://github.com/openshift/origin/issues/1244 But it's not directly related to kubernetes.

Regards, Smana

-- Smana
kubernetes

1 Answer

9/21/2015

Services are accessible from all namespaces as long as you address them using both the name and the namespace.

For example, if you have a service named db in namespace dev, you can access it using the DNS name db. While this won't work from qa, you can access it from both qa and dev if you instead use the DNS name db.dev (<service>.<namespace>), in order to clarify which namespace should be searched for the service.

-- Alex Robinson
Source: StackOverflow