GCE Consume Environment Variable from Java

9/18/2017

I'm creating an environment-variable with

 env :
        - name: GCE_ENV
          value: my-value

Is there a way to consume that from Java / Scala?

 "echo $GCE_ENV" !!

Did not grab it; I guess the JVM console session doesn't get it set?

Logging into the container did work

kubectl exec -it POD -- /bin/bash
bash-4.3$ echo $GCE_ENV
my-value
-- brent
environment-variables
google-compute-engine
kubernetes
scala

1 Answer

9/18/2017

Getting env variable from Java is done through:

System.getenv("GCE_ENV")
-- benjamin.d
Source: StackOverflow