Bootstrap FreeKB - OpenShift - Expose a route on an ingress router by labeling the route
OpenShift - Expose a route on an ingress router by labeling the route

Updated:   |  OpenShift articles

Let's say you have a route that is not exposed. Notice in this example that the route's request host is my-route-my-project.apps.openshift.example.com but Request Host does not include a line that begins with "exposed on".

~]$ oc describe route my-route
Name:                   my-route
Namespace:              my-project
Created:                2 minutes ago
Requested Host:         my-route-my-project.apps.openshift.example.com

Path:                   <none>
TLS Termination:        passthrough
Insecure Policy:        Redirect
Endpoint Port:          https
Service:                my-service
Weight:                 100 (100%)
Endpoints:              10.11.12.13:8443

 

This may mean that you have more than one type of ingress router. The oc get pods command can be used to list the pods in the openshift-ingress namespace. Notice in this example that there are three types of ingress routers.

  • default
  • internal
  • external
~]$ oc get pods --namespace openshift-ingress
NAME                                      READY   STATUS    RESTARTS   AGE
router-default-6f84fdff65-4zdmp           1/1     Running   0          57d
router-default-6f84fdff65-t7h22           1/1     Running   0          57d
router-default-6f84fdff65-z579b           1/1     Running   0          57d
router-external-router-7c7cf7cccd-2cgj5   1/1     Running   0          57d
router-external-router-7c7cf7cccd-8nj9d   1/1     Running   0          57d
router-internal-router-7c74f95ffd-dspfs   1/1     Running   0          57d
router-internal-router-7c74f95ffd-pfmsv   1/1     Running   0          57d

 

The oc get ingresscontrollers command can be used to list the ingress controllers in the openshift-ingress-operator namespace.

~]$ oc get ingresscontrollers --namespace openshift-ingress-operator
NAME              AGE
default           360d
external-router   356d
internal-router   356d

 

And the domain name of each ingress controller can be returned.

~]$ oc get ingresscontroller default --namespace openshift-ingress-operator --output jsonpath="{.status.domain}"
apps.openshift.example.com

~]$ oc get ingresscontroller internal-router --namespace openshift-ingress-operator --output jsonpath="{.status.domain}"
internal.openshift.example.com

~]$ oc get ingresscontroller external-router --namespace openshift-ingress-operator --output jsonpath="{.status.domain}"
external.openshift.example.com

 

In this example, since my-route domain name is apps.openshift.example.com, the route must be exposed on the default ingress router. The oc label route command can be used to label the route.

~]$ oc label route my-route route-type=default
route.route.openshift.io/my-route labeled

 

The oc describe route command can be used again to see that now the route is exposed.

~]$ oc describe route my-route
Name:                   my-route
Namespace:              my-project
Created:                2 minutes ago
Requested Host:         my-route-my-project.apps.openshift.example.com
                           exposed on router default (host router-default.apps.openshift.example.com) 23 minutes ago

Path:                   <none>
TLS Termination:        passthrough
Insecure Policy:        Redirect
Endpoint Port:          https
Service:                my-service
Weight:                 100 (100%)
Endpoints:              10.11.12.13:8443

 

And here is how you can remove a label. In this example, the route-type label will be removed.

~]$ oc label route my-route route-type-
route.route.openshift.io/my-route labeled

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 78b72d in the box below so that we can be sure you are a human.