3

I'm new to OpenShift. I have two projects|namespaces. In each I have a rest service. What I want is service from NS1 access service from NS2 without joining projects networks. Also SDN with multi tenant plugin.

I found example on how to add external services to cluster as native. In NS1 I created an Endpoint for external IP of Service form NS2, but when I tried to create a Service in NS1 for this Endpoint, it failed cause there was no type tag (which wasn't in example also).

I also tried ExternalName. For externalName key my value was URL of router to service in NS2. But it doesn't work pretty well, cause it always returns me a page with Application is not available. But app\service works.

halfer
  • 19,824
  • 17
  • 99
  • 186
Vito Karleone
  • 355
  • 1
  • 6
  • 17
  • Hi, did you find a solution without network join? Also, how can I add the plugin - opensift v3.11 - from consoe? creatd a cluster from the console – user2503775 May 03 '20 at 10:27

2 Answers2

2

Services in different namespaces are not external, but local to the cluster. So you simply access the services using DNS:

for example: servicename.svc.cluster.local or simply servicename.svc

see also https://docs.openshift.com/enterprise/3.0/architecture/additional_concepts/networking.html

Markus Dresch
  • 5,290
  • 3
  • 20
  • 40
  • 2
    No, Doesn't work. Just tried to curl service like U said: curl service.svc.cluster.local:port/. Error: curl: (6) Could not resolve host: ..... . If I join networks I can access by service.project_name. Maybe it's cause I have SDN multi tenant plugin. Interested in some other solutions than joining networks. Thanks! – Vito Karleone Jan 30 '19 at 12:20
0

Your question is not very clear and lacks information regarding your network setup and what you mean by joining projects network. What does the SDN multi-tenancy do for example? By default, the network within the cluster is routable within the whole cluster. If you expose a service in a namespace NS_A, it can access a services in namespace NS_B like so:

Pod in namespace A : curl servicename.NS_B:port

vice versa:

Pod in namespace B : curl servicename.NS_A:port

If your SDN setup makes that impossible, you can expose both service with an Ingress / route and address is from the network where you expose those ( public or not ).

Read the docs on those, for example:

https://kubernetes.io/docs/concepts/services-networking/ingress/

That website is a great resource for all things Kubernetes (like OpenShift). In OpenShift a slightly different take on it is with routes :

https://docs.openshift.com/container-platform/4.11/networking/routes/route-configuration.html

Basically, try to understand how the networks are set up and how these principles work. If this does not answer your question, please make it more clear and specific.

In OpenShift, this works by default from one pod to another in another namespace:

curl -k -vvv http://maintenance-page.NS_B.svc:8080
Vincent Gerris
  • 7,228
  • 1
  • 24
  • 22