Which HOST+PORT to use for NodeJS app on OpenShift?

7/3/2018

I can't get my NodeJS-app working on OpenShift. Everywhere it is written to use the env. variables

OPENSHIFT_NODEJS_PORT
OPENSHIFT_NODEJS_IP

but they are not present in my pod. If I just listen on some other IP and PORT (e.g. on port 3000 of 127.0.0.1), the app successfully deploys but does not receive any requests (and also cannot be reached from the exposed address). Output of the printenv command in the terminal of my pod running the NodeJS app is in the attached pictures (sorry, did not figure out how to copy text from the web terminal).

Output of printenv, 1

Output of printenv, 2

All variables having something to do with NODEJS_* indicate the IP 172.30.72.54, and PORT 8080. However, if I use these, I get a "listen EADDRNOTAVAIL" error.

Btw, also the OpenShift CLI indicates the same IP and PORT:

$ oc get services
NAME      TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)     AGE
mongodb   ClusterIP   172.30.20.188   <none>        27017/TCP   2d
nodejs    ClusterIP   172.30.72.54    <none>        8080/TCP    2d

So by now, I don't have any clue and can't find any information about what IP and PORT to use for my NodeJS app. Thanks for any help!

-- Jonas Asprion
kubernetes
node.js
openshift
port

0 Answers