OpenShift Environment Variables: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 10: Line 10:


Environment variables can be declared in:
Environment variables can be declared in:
* [[OpenShift_Concepts#Deployment_Configuration|deployment configurations]]. This is an example of how to [[OpenShift_DeploymentConfig_Definition#env|set custom environment variables in the deployment configuration]].
* [[OpenShift_Concepts#Deployment_Configuration|deployment configurations]] or [[OpenShift_Pod_Definition#env|pod templates]]. This is an example of how to [[OpenShift_Pod_Definition#env|set custom environment variables in a pod template]].
* [[OpenShift_Concepts#Replication_Controller|replication controllers]].
* [[OpenShift_Concepts#Replication_Controller|replication controllers]].
* [[OpenShift_Concepts#Build_Configuration|build configurations]].  
* [[OpenShift_Concepts#Build_Configuration|build configurations]].  
Line 19: Line 19:


Some environment variables are automatically exported:
Some environment variables are automatically exported:
==Environment Variables Corresponding to Other Services==


* <''SVCNAME''>_SERVICE_HOST
* <''SVCNAME''>_SERVICE_HOST
* <''SVCNAME''>_SERVICE_PORT
* <''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:
{{Internal|OpenShift_Service_Concepts#Overview|OpenShift Service Concepts}}

Latest revision as of 20:41, 7 March 2018

External

Internal

Overview

Environment variables can be declared in:

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:

OpenShift Service Concepts