title: Kubernetes equivalent of env-file in Docker
body: <p><strong>Background:</strong></p>
  
  <p>Currently we're using Docker and Docker Compose for our services. We have externalized the configuration for different environments into files that define environment variables read by the application. For example a <code>prod.env</code> file:</p>
  
  <pre><code>ENV_VAR_ONE=Something Prod
  ENV_VAR_TWO=Something else Prod
  </code></pre>
  
  <p>and a <code>test.env</code> file:</p>
  
  <pre><code>ENV_VAR_ONE=Something Test
  ENV_VAR_TWO=Something else Test
  </code></pre>
  
  <p>Thus we can simply use the <code>prod.env</code> or <code>test.env</code> file when starting the container:</p>
  
  <pre><code>docker run --env-file prod.env &lt;image&gt;
  </code></pre>
  
  <p>Our application then picks up its configuration based on the environment variables defined in <code>prod.env</code>. </p>
  
  <p><strong>Questions:</strong></p>
  
  <ol>
  <li>Is there a way to provide environment variables from a file in Kubernetes (for example when defining a pod) instead of hardcoding them like this:</li>
  </ol>
  
  <pre>
  apiVersion: v1
  kind: Pod
  metadata: 
    labels: 
      context: docker-k8s-lab
      name: mysql-pod
    name: mysql-pod
  spec: 
    containers: 
      - 
        env: 
          - 
            name: MYSQL_USER
            value: mysql
          - 
            name: MYSQL_PASSWORD
            value: mysql
          - 
            name: MYSQL_DATABASE
            value: sample
          - 
            name: MYSQL_ROOT_PASSWORD
            value: supersecret
        image: "mysql:latest"
        name: mysql
        ports: 
          - 
            containerPort: 3306
  </pre>
  
  <ol start="2">
  <li>If this is not possible, what is the suggested approach?</li>
  </ol>