<p>I'm having an issue right now when trying to create a PHP (Laravel) pod in my Kubernetes cluster. As php-fpm is a service run by the user www-data, he doesn't have access to the environments variables that Docker or Kubernetes sets up, which is the source of my problem.</p>

<p>We have beta and production pods, and previously, the only thing I did was setup an environment variable in my Kubernetes deployment which would tell the container if it had to use the beta or the prod configuration.</p>

<p>Sadly, since the php-fpm process can't access them, this is not possible. Is there a clean way to handle this? One way I can think of doing it right now is to put my two different .env files (config file for Laravel) in two different secrets in Kubernetes, then after that have a script as my Docker image's entrypoint that copies the right .env at the root of the project since the script will have access to the ENV variables.</p>

<p>If someone has a cleaner way in mind, I'm all ears! </p>

<p>You could put the <code>clear_env = no</code> in your php-fpm.conf or a file included from it, <a href="https://github.com/docker-library/php/issues/74#issuecomment-79102385" rel="nofollow noreferrer">as discussed here</a>.</p>
