10

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

1 Answer 1

13

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks Alex, i'll try that
for me that does not work. is there some reference in the docs about this?
It's likely that the cluster you're using has some security policies set up, such as network policies (kubernetes.io/docs/concepts/services-networking/…), that prevent the communication. Communicating across namespaces like this still works in plain vanilla clusters. If you have a cluster admin of some sort, I'd ask them what's up.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.