Bootstrap FreeKB - OpenShift - List Routes using the oc get routes command
OpenShift - List Routes using the oc get routes command

Updated:   |  OpenShift articles

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

A route or an ingress object will provide a URL such as which is used to route a request onto a service, which is then routed onto a pod, and then to the container in the pod, and finally to the application running in the container.


Like this.


Here is an example of what could be returned by the oc get routes command.


The -A or --all-namespaces flag can be used to list the routes in every project / namespace.

The -n or --namespace flag can be used to list the routes in a certain project / namespace.

~]# oc get routes
NAME        HOST/PORT                                          PATH   SERVICES     PORT     TERMINATION          WILDCARD
my-route            my-service   8080     reencrypt/Redirect   None


The oc describe route command can be used to show more information about a route. 

In this example, when a request is submitted to http:/, the request will be forwarded onto the service named "my-service".

When a route is created, the format of the route URL is <route name>-<project/namespace>-<ingress domain>:<port>.

~]# oc describe route my-route

Name:                   my-route
Namespace:              my-project
Created:                7 days ago
Labels:                 app=my-app
Requested Host:
                          exposed on router default (host 7 days ago
Path:                   <none>
TLS Termination:        reencrypt
Insecure Policy:        Redirect
Endpoint Port:          prometheus

Service:        my-service
Weight:         100 (100%)
Endpoints:      <error: endpoints "my-route" not found>


Or, the oc get routes command with the --output json‚Äč or --output yaml option can be used.

~]$ oc get route my-route --output json
    "apiVersion": "",
    "kind": "Route",
    "metadata": {
        "annotations": {
            "": "true"
        "creationTimestamp": "2022-07-28T01:44:51Z",
        "labels": {
            "app": "my-app",
            "": "my-app",
            "": "my-app"
        "name": "my-route",
        "namespace": "foo",
        "resourceVersion": "446042921",
        "uid": "769c8df4-9924-4d0e-a551-f465f1397a66"
    "spec": {
        "host": "",
        "port": {
            "targetPort": "8080-tcp"
        "to": {
            "kind": "Service",
            "name": "my-service",
            "weight": 100
        "wildcardPolicy": "None"
    "status": {}


The --output jsonpath option can be used to print the value of a specific JSON key.

~]$ oc get route my-route --output jsonpath={}


Did you find this article helpful?

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


September 18 2023 by Frank King
very helpful...

Add a Comment

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