Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure multiple paths for an Openshift Route

I'd like to define in Openshift one route with multiple paths, each path forwarding to a different service. For example /pathA would forward requests to ServiceA , whilst /pathB would forward requests to ServiceB.

Is this possible in OpenShift? If not, what would be the recommended approach?

I have also read about route sharding, however I cannot say that I've grasped the concept clearly.

Thanks.

like image 985
theAsker Avatar asked May 16 '19 14:05

theAsker


People also ask

How do routes work in OpenShift?

An OpenShift Container Platform route exposes a service at a host name, such as www.example.com, so that external clients can reach it by name. DNS resolution for a host name is handled separately from routing.

What is difference between route and service in OpenShift?

Routes are http, HTTPS, or TCP wrapped with TLS. You can use a service with a "node port", which load balances your app instances over TCP or udp at a high port exposed on each node.

What is passthrough route?

With passthrough termination, encrypted traffic is sent straight to the destination without the router providing TLS termination. Therefore no key or certificate is required on the route. Prerequisites. You must have a service that you want to expose.


1 Answers

You need to create multiple routes per each path. But it can add multiple paths to same hostname. It's a same result of one route with multiple path you said. Refer Path Based Routes for more details.

For ServiceA,

apiVersion: v1
kind: Route
metadata:
  name: route-path-a
spec:
  host: www.example.com
  path: "/patha"   
  to:
    kind: Service
    name: service-a

For ServiceB,

apiVersion: v1
kind: Route
metadata:
  name: route-path-b
spec:
  host: www.example.com
  path: "/pathb"   
  to:
    kind: Service
    name: service-b
like image 166
Daein Park Avatar answered Oct 27 '22 09:10

Daein Park