Navigate to a specific path through Nodeport

6/13/2018

I have created and deployed an application on ICP 2.1. Have exposed NodePort as my service. Iam able to navigate to the url from the Nodeport. How do i go to a specific path on the url directly from the Nodeport. Iam using yaml file to create the deployment and service. Where should i specify the path??

-- vidya
ibm-cloud-private
kubernetes

1 Answer

6/13/2018

How do i go to a specific path on the url directly from the Nodeport

The short version is that you don't, since a NodePort is merely an exposure of an existing port: from a Service.

The medium length version is that using an ingress controller (such as the "default" nginx one) would allow you to add an app-root to the Ingress resource, and then use the NodePort belonging to the ingress controller rather than the NodePort of the upstream Service itself. I'm pretty sure all of the ingress controllers support that kind of behavior since it's a fairly common scenario.

The long version is that you can manually put something like nginx or haproxy between your Service and the upstream Pod to artificially inject a URI prefix, with the disadvantage that if you wish to do that more than once, you'd be better off using an Ingress resource so that functionality is handled for you in a standardized way.

-- mdaniel
Source: StackOverflow