Skip to main content
Hello and welcome to this lesson on OpenShift for beginners. In this lesson you’ll learn how to expose an application running on OpenShift so that other workloads inside the cluster — or external users — can reach it. The typical end-to-end flow is:
  1. Create a Service to expose your pods inside the cluster (ClusterIP).
  2. Create a Route to expose that Service externally (HTTP/HTTPS).
  3. Verify the application via the ClusterIP (internal) and the Route (external).

Create a Service (internal exposure)

If your builds and deployments are already configured, the next step is to create a Service to make your application reachable from other pods and services inside the cluster. Start by getting a Service YAML template (for example, via the OpenShift console “Learn More” / “Import YAML” option). Create a file named service-config.yaml and paste the template into it. An initial template might look like this:
This template contains a few key fields: Update the selector and ports to match your application (in this example the app listens on port 8080). Remove the clusterIP field so OpenShift assigns it automatically:
Apply the Service:
  • Via the OpenShift web console: choose Import YAML or JSON, paste service-config.yaml, and click Create.
  • Or via CLI: oc apply -f service-config.yaml
After creation, open the Service details in the console to view the assigned Cluster IP and ports.
A screenshot of the OpenShift Origin web console showing the "Services" page for a project named My WebApplication. It lists two services (simple-webapp-docker and simple-webapp) with Cluster IPs, port 8080/TCP, selectors, and ages.
The Service will have an assigned Cluster IP (for example 172.30.163.74). This IP is reachable only from inside the cluster network — not from the public internet.
ClusterIP Services are internal to the cluster. To be reachable from outside the cluster you need to expose the Service using a Route (on OpenShift) or use a NodePort/LoadBalancer Service type depending on your environment.
You can test the Service from a machine or container that has network access to the cluster. For example, from the OpenShift host VM (Minishift) or from another pod:
Example output:

Create a Route (external exposure)

To make the Service accessible to external HTTP(S) clients, create an OpenShift Route. You can create Routes via YAML (same approach as Services) or from the web console. Here we’ll use the console: click Create Route. The Create Route form allows you to set the route name, hostname, path, service, and target port. If you leave the hostname blank, OpenShift will generate a hostname for you.
A screenshot of the OpenShift Origin web console displaying the "Create Route" form for a project called "My WebApplication," with fields for Name, Hostname, Path, Service, and Target Port. The left sidebar shows navigation items like Applications, Builds, Resources, Storage, Monitoring, and Catalog.
Important Route form fields:
If you specify a custom hostname (for example www.example.com), ensure your external DNS points that hostname to the OpenShift router. Once traffic reaches the cluster, Routes direct it to the correct Service based on hostname/path.
Leave other fields at their defaults and create the Route. After creation you will see the generated hostname for the route in the console.
Screenshot of the OpenShift Origin web console showing the "simple-webapp-docker" service details, route and traffic info, and a running pod. A green notification at the top-right indicates the route was successfully created.
Clicking the route URL opens the application in a browser. If you deploy an update (for example change the message from “Update 4” to “Update 5”) and push your code, the BuildConfig will trigger a new build and OpenShift will deploy the new image. The updated UI will be visible at the same route URL after the deployment completes.

Quick reference and commands

  • Create a Service:
    • Console: Import YAML / Create → paste YAML → Create
    • CLI: oc apply -f service-config.yaml
  • Verify Service:
    • oc get svc
    • oc describe svc simple-webapp-docker
  • Create a Route:
    • Console: Applications → Routes → Create Route
    • CLI example: oc expose svc/simple-webapp-docker --hostname=your.host.example.com
That’s it for this lesson.

Watch Video