If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.
There are a few different ways to route external requests to a pod / service.
An OpenShift route or an Ingress route will provide a URL such as http://my-route-my-project.apps.openshift.example.com 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.
The oc expose service command can be used to create an insecured route, whereas the oc create route command is used to create a secured route.
The oc get services command can be used to list the services that have been created in the currently selected. Let's say you want to create an OpenShift route that will be used to route requests to my-service.
~]# oc get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE my-service ClusterIP 172.30.164.121 <none> 8080/TCP 114d
The oc expose service command can be used to create a route that will be used to route requests onto a service. Often, the following options are used.
~]$ oc expose service my-service --name my-route --port 8080 --labels route-type=default route.route.openshift.io/my-route exposed
The oc get routes command can then be used the list the routes. In this example, the route URL is http://my-route-my-project.apps.openshift.example.com. The syntax of the URL is <route name>-<project/namespace>-<ingress domain name>:<port><optional endpoint>.
~]# oc get routes NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD my-route my-route-my-project.apps.openshift.example.com my-service 8080-tcp None
The oc describe route command can be used to display more details about the route. Notice that the route has been exposed on router default.
~]$ oc describe route my-route Name: my-route Namespace: my-project Created: 17 minutes ago Labels: name=my-route Annotations: openshift.io/host.generated=true Requested Host: my-route-my-project.apps.openshift.example.com exposed on router default (host router-default.apps.openshift.example.com) 17 minutes ago Path: /example TLS Termination: <none> Insecure Policy: <none> Endpoint Port: 8080 Service: my-service Weight: 100 (100%) Endpoints: 10.217.0.68:8080
The default router pod should be in the openshift-ingress project/namespace.
~]$ oc get pod --namespace openshift-ingress NAME READY STATUS RESTARTS AGE router-default-f6d44996c-sljgl 1/1 Running 2 (58m ago) 56d
The router pods run an haproxy (high availability proxy) load balancer, which can be seen with the oc exec command.
~]$ oc exec pod/router-default-76c5c89559-dclkw --namespace openshift-ingress -- cat /var/lib/haproxy/conf/haproxy.config | grep my-route server pod:my-pod:my-service:8080-tcp:10.129.7.69:8080 10.129.7.69:8080 cookie 15b9071e86b87a2b4b6f976291de96cf weight 256 check inter 5000ms
If the application in the pod is a web based application, you should now be able to interact with the application using the route URL.
Or using curl.
~]# curl my-route-my-project.apps.openshift.example.com Hello OpenShift!