OpenShift Environment Variables
Jump to navigation
Jump to search
External
Internal
Overview
Environment variables can be declared in:
- deployment configurations or pod templates. This is an example of how to set custom environment variables in a pod template.
- replication controllers.
- build configurations.
They can also be set with:
oc set env
Some environment variables are automatically exported:
Environment Variables Corresponding to Other Services
- <SVCNAME>_SERVICE_HOST
- <SVCNAME>_SERVICE_PORT
TOMCAT2_PORT=tcp://172.30.29.184:8080 TOMCAT2_PORT_8080_TCP=tcp://172.30.29.184:8080 TOMCAT2_PORT_8080_TCP_ADDR=172.30.29.184 TOMCAT2_PORT_8080_TCP_PORT=8080 TOMCAT2_PORT_8080_TCP_PROTO=tcp TOMCAT2_PORT_8443_TCP=tcp://172.30.29.184:8443 TOMCAT2_PORT_8443_TCP_ADDR=172.30.29.184 TOMCAT2_PORT_8443_TCP_PORT=8443 TOMCAT2_PORT_8443_TCP_PROTO=tcp TOMCAT2_PORT_8778_TCP=tcp://172.30.29.184:8778 TOMCAT2_PORT_8778_TCP_ADDR=172.30.29.184 TOMCAT2_PORT_8778_TCP_PORT=8778 TOMCAT2_PORT_8778_TCP_PROTO=tcp TOMCAT2_SERVICE_HOST=172.30.29.184 TOMCAT2_SERVICE_PORT=8080 TOMCAT2_SERVICE_PORT_8080_TCP=8080 TOMCAT2_SERVICE_PORT_8443_TCP=8443 TOMCAT2_SERVICE_PORT_8778_TCP=8778
Note that the environment variables corresponding to a specific service are only injected in a pod if the service existed at the time the pod deployment. For more about services and communication between services see: