Skip to Content
Learn OpenShift
book

Learn OpenShift

by Denis Zuev, Artemii Kropachev, Aleksey Usov
July 2018
Intermediate to advanced
504 pages
11h 34m
English
Packt Publishing
Content preview from Learn OpenShift

Creating a route by using oc expose

You can create a route using oc expose in the following way:

$ oc expose svc httpdroute "httpd" exposed$ oc get routeNAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARDhttpd httpd-simpleappication.127.0.0.1.nip.io httpd 8080 None$ curl -s http://httpd-simpleappication.127.0.0.1.nip.io | head -n 4<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">  <head>$ oc delete route httpdroute "httpd" deleted
The 127.0.0.1.nip.io DNS zone is used by default by the oc cluster up method.

You may want to create a route with an alternate URL, using the --hostname option:

$ oc expose svc httpd --name httpd1 --hostname ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Operating OpenShift

Operating OpenShift

Rick Rackow, Manuel Dewald
OpenShift for Developers, 2nd Edition

OpenShift for Developers, 2nd Edition

Joshua Wood, Brian Tannous
Kubernetes: Up and Running, 2nd Edition

Kubernetes: Up and Running, 2nd Edition

Brendan Burns, Joe Beda, Kelsey Hightower

Publisher Resources

ISBN: 9781788992329Supplemental Content