kubernetes set root environmental variables

12/6/2017

I have a rails app that runs apache2 as root with database.yml config values set by environmental variables passed in via a kubernetes configmap.

However, since apache2 is a root process, it doesn't have the passed in environmental values. How do I set the environmental values for root from kubernetes configmap?

-- snowflakekiller
kubernetes
ruby-on-rails

1 Answer

12/10/2017

since apache2 is a root process, it doesn't have the passed in environmental values.

If Use ConfigMap-defined environment variables is not possible, you could add ConfigMap data to a Volume, which then can be read by a wrapper to the apache2 runner.
That wrapper can:

  • read the values in the config-map-based volume
  • set the right environment variables
  • launch Apache2
-- VonC
Source: StackOverflow