IBM/minishift101 - step 4 networking
Once it has been verified that the application is up and running as instructed in the previous lab (Step 3), the next step is to configure access for the application outside of the cluster.
There are several ways to do this:
Node-port services
Port-forwarding
Routes
4.1 Node port services
This is the cleanest way to access the applications outside of OpenShift environment both locally and publicly. This way essentially makes use of the cluster node's IPs and a port in between the range (30000-32767) and tells OpenShift to proxy to the underlying application via. the port. This is better than the next two solutions for several reasons: we don't have to worry about port clashes, this works for non HTTP based services and finally, does not require a public host name.
To expose our deployment via NodePort, we simply expose the deployment with a load balancer type and label it with name nodejs-ex-ingress:
To see the NodePort created, we can run:
We can use the NodePort in conjuction with the cluster's internal or external IP which we can find in the following command:
We should then be able to access the application in the browser. In this example, we can access the Node application at 192.168.64.11:31692
:
4.2 Port-forwarding
Alternatively, if you want to quickly access a port of a specific pod of your cluster, you can also use the oc port-forward
command:
4.3 Routes
For web applications, the most common way to expose it is by a route. A route exposes the service as a host name. You can do this by running the command providing you have a host name available:
Congratulations! You have completed all labs in this workshop! You have learnt how to:
Create an OpenShift project
Create an OpenShift application in various ways
How to monitor the status of an application
How to access and expose your application
For more information on how to navigate Minishift, check the Minishift docs
Last updated
Was this helpful?