Oc env: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= oc")
 
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Internal=
=Internal=


[[oc#Commands|oc]]
* [[oc#Commands|oc]]
 
=Overview=
 
List environment variables defined by the target object:
 
oc env <''target''> --list
 
Example:
 
oc env dc/jenkins --list
 
=Set Environment Variable Values=
 
oc env <''target''> <''env_var_name''>=<''env_var_value''>
 
oc env dc/router ROUTER_USE_PROXY_PROTOCOL=false
 
=Remove an Environment Variable=
 
  oc env <''target''> <''env_var_name''>-
 
  oc env dc/router ROUTER_USE_PROXY_PROTOCOL-
 
=Set a Secret as Environment Variable=
 
oc env dc/<''deployment-config-name''> --from=secret/<''secret-name''> --prefix=SOME_PREFIX_
 
env | grep SOME_PREFIX
SOME_PREFIX_DB_PASSWD=passwd123
 
More about [[OpenShift_Secrets_Concepts#An_Example|secrets]].

Latest revision as of 18:09, 30 January 2018

Internal

Overview

List environment variables defined by the target object:

oc env <target> --list

Example:

oc env dc/jenkins --list

Set Environment Variable Values

oc env <target> <env_var_name>=<env_var_value>
oc env dc/router ROUTER_USE_PROXY_PROTOCOL=false

Remove an Environment Variable

 oc env <target> <env_var_name>-
 oc env dc/router ROUTER_USE_PROXY_PROTOCOL-

Set a Secret as Environment Variable

oc env dc/<deployment-config-name> --from=secret/<secret-name> --prefix=SOME_PREFIX_
env | grep SOME_PREFIX
SOME_PREFIX_DB_PASSWD=passwd123

More about secrets.