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.
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.
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.
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.
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
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