OpenShift Environment Variables: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=External= * https://docs.openshift.com/container-platform/latest/dev_guide/environment_variables.html =Internal= * OpenShift_Concepts#Environment_Variables|OpenShift Con...") |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
=Internal= | =Internal= | ||
* [[OpenShift_Concepts#Environment_Variables|OpenShift Concepts | * [[OpenShift_Concepts#Environment_Variables|OpenShift Concepts]] | ||
=Overview= | =Overview= | ||
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_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:
- 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: