You’ve finally installed your OpenShift platform and now want to make sure everything is working as expected.
In this guide, we’ll deploy a simple web service using the Apache web server and expose it to the internet. By accessing the application from a public web browser, you’ll be able to confirm that your OpenShift cluster is up, running, and correctly handling real workloads. This guide uses the Openshift CLI to achieve all tasks, if you are interested in the Web UI platform version see here
Create a new project
We are deploying a website for a fictitious marketing department. Lets start by creating the project namespace.
% oc new-project marketing-website
Now using project "marketing-website" on server "https://api.prodcluster.demo.io:6443".
Create an Apache deployment.
Openshift can pull images directly from external registries like Quay and Dockerhub. In this example we are using httpd image from Quay. We are creating 3 replicas (3 instances of apache for redundancy) just for kicks.
% oc create deployment website --image=quay.io/fedora/httpd-24-micro --replicas=3
deployment.apps/website created
You can now verify if everything went according to plan by Querying the deployments and pods from OpenShift
oc get deployments
oc get pods
from our example.
% oc get pods
NAME READY STATUS RESTARTS AGE
website-7bdb987557-98vk5 1/1 Running 0 4s
website-7bdb987557-hzqv5 1/1 Running 0 4s
website-7bdb987557-n7vff 1/1 Running 0 4s
Expose the container internally as a Service
At this point, the website containers are running internally, but for them to be reachable by other services on the same cluster, we have to expose them using a service.
% oc expose deployment website --port=8080 --target-port=8080
service/website exposed
We can verify that the service is exposed internally.
% oc get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
website ClusterIP 172.30.50.103 <none> 8080/TCP 7s
Now we are ready to expose the service externally for the whole wide world.
Expose the Service externally (Route)
Create an OpenShift Route to make Apache accessible from outside the cluster:
% oc expose svc website
route.route.openshift.io/website exposed
And verify
% oc get route
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
website website-marketing-website.apps.prodcluster.demo.io website 8080 None
If you configured wildcard DNS as discussed earlier, your service should now be accessible by just entering (http://website-marketing-website.apps.prodcluster.demo.io) into a web browser. If not, then you would need to make a dns entry on your DNS to point this domain to your Openshift Cluster.

Cleanup
We can now safely clean up since this was a demo to verify that our shiny new Openshift installation is working as advertised.
% oc delete project marketing-website
project.project.openshift.io "marketing-website" deleted
