DEV Community

Cover image for How to create route in OpenShift?
Sagar Jadhav
Sagar Jadhav

Posted on • Edited on • Originally published at developersthought.in

How to create route in OpenShift?

Objective

  • Access application via Service IP within cluster
  • Access application via Service IP outside cluster
  • Create route
  • Access application via HTTP Route
  • Create Edge Terminating Route
  • Access application via HTTPS Route

Step 1: Deploy Nginx application

Refer How to manage Users & Project in Openshift?

Step 2: List services

oc get svc
Enter fullscreen mode Exit fullscreen mode

Step 3: Access application via service ip within cluster

curl http://<SERVICE_IP>:80
Enter fullscreen mode Exit fullscreen mode

Step 4: Access application via service ip outside cluster

From browser, Browse http://<SERVICE_IP>:80
Enter fullscreen mode Exit fullscreen mode

Step 5: Create route

oc expose service <SERVICE_NAME>
Enter fullscreen mode Exit fullscreen mode

Step 6: Describe route

oc get route
Enter fullscreen mode Exit fullscreen mode

Step 7: Access application via HTTP route

From browser, Browse http://<ROUTE_URL>
Enter fullscreen mode Exit fullscreen mode

Step 8: Create self-signed certificates

openssl genrsa -out example.key 2048
Enter fullscreen mode Exit fullscreen mode
openssl req -new -key example.key -out example.csr -subj "/C=US/ST=CA/L=Los Angeles/O=Example/OU=IT/CN=test.example.com"
Enter fullscreen mode Exit fullscreen mode
openssl x509 -req -days 366 -in example.csr -signkey example.key -out example.crt
Enter fullscreen mode Exit fullscreen mode

Step 9: Create edge terminated route

oc create route edge --service=nginx --key=example.key --cert=example.crt
Enter fullscreen mode Exit fullscreen mode

Step 6: Describe route

oc get route
Enter fullscreen mode Exit fullscreen mode

Step 7: Access application via HTTPS route

From browser, Browse https://<ROUTE_URL>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)