DEV Community

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

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

2 2

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

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay