Java

What are Routes in context of OpenShift ?

Let’s say we need to have a way to reach a service in OpenShift. So we gave that service a name, for example: www.reach-my-service-as-route.com.

So simply put we gave it an externally reachable hostname and defined that as a Route. Because of this connectivity now external clients can reach our applications. Each route consists of a route name which is limited to 63 characters. Service selector and security configuration which is optional.

OpenShift Routers support the following protocols as of today: HTTP, HTTPS (with SNI), WebSockets, TLS with SNI.

Note: Server Name Indication (SNI) is an extension to the Transport Layer Security (​TLS).

Even though OpenShift service helps will load balancing. A router uses the service selector to find the service and the endpoints supporting the service. Service-provided load balancing is avoided and substituted with the router’s private load balancing.

In OpenShift Routes if two routes claim the same host, the oldest route wins. Same applies if multiple routes with the same path are used, the oldest takes priority.

Example 1:

A service with an externally reachable host name aka a template for a Route with a Specified Host:

apiVersion: v1

kind: Route

metadata:

  name: host-route

spec:

  host: www.reach-my-service-as-route.com

  to:

    kind: Service

    name: service-name

Example 2:

A service with an externally reachable host name aka a template for a Route A without a Host:

apiVersion: v1

kind: Route

metadata:

  name: no-route-hostname

spec:

  to:

    kind: Service

    name: service-name

For a detailed explanation on Routes in OpenShift follow the Red Had OpenShift Documentation.

Leave a Reply