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
In order to access an application running in a different namespace, you need to add the namespace to the service name, as if it was its domain. For example, if your first namespace was named cindylopez , the same redis instance we accessed on the previous example would be available via redis.
In Kubernetes the namespace is used to isolate the resource, based on the use case services in different namespace may required to access the service located in another namespace and kubernetes allow this by using ExternalName concept.
Namespaces are used to isolate resources within the control plane. For example if we were to deploy a pod in two different namespaces, an administrator running the “get pods” command may only see the pods in one of the namespaces. The pods could communicate with each other across namespaces however.
Allow two pods (say pod A and B) running in same/different namespace communicate irrespective of the protocol(say http,https,akka. tcp) along with a valid Network policy applied. Solutions tried: Tried applying network policy to both the pods and also used the service name: “my-svc.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With