Expose OpenShift Apps over HTTPS

This is a quick how-to guide for deploying a very simple hello-world web application on OpenShift and expose it over HTTPS . You can follow the same approach to expose any application securely overly HTTPS.

The POD and Service YAML for the hello-world application is given below.

kind: Pod
apiVersion: v1
name: hello-world
app: hello-world
- name: hello-world
image: quay.io/powercloud/http-echo
- "-text=hello-world"
- name: pull-secret
---kind: Service
apiVersion: v1
name: hello-world-service
app: hello-world
- port: 5678

Once this is deployed you’ll have a “hello-world-service”

$ oc get svcNAME                 TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
hello-world-service ClusterIP <none> 5678/TCP 29s

In order to expose this service securely over HTTPS, all you have to do is create an “edge” route as shown below:

$ oc create route edge --service=hello-world-serviceroute.route.openshift.io/hello-world-service created

Find out the full service URL by running the following command:

$ oc get routes/hello-world-service -o json | jq -r '.spec.host'hello-world-service-sample.apps.bpradipt-bef3.

For more advanced configuration on “edge” routes like using custom certificates please refer to the official OpenShift docs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store