<p>Hello I am new to kubernetes. I am currently stuck trying to use a docker image from dockerhub were it is a php-fpm image. I would like to be able to customize the php.ini in a configmap how would I go about doing that. The image on dockerhub is 
<a href="https://hub.docker.com/r/crunchgeek/php-fpm" rel="nofollow noreferrer">crunchgeek/php-fpm</a>  and the instructions for php.ini say there is a environment variable  "PHP_INI_PATH=/path/to/php.ini
will include specified php.ini configuration during php-fpm manager start. It allows to use a wildcard in case you would like to include several .ini configuration files."  How can I add a environment variable that controls the php.ini file to a configmap in kubernetes  please a yaml example would help me so much thanks.</p>

Jean loriston
<p>In case you want to mount a configuration file of PHP .ini (creating a configmap from file) to your pod can do the following depends on if you're using helm or not.</p>

<p>When using helm you need to create a config map YAML file and put the desired configuration file (php.ini in your scenario) under a dedicated folder, (e.g <strong>conf</strong> folder) in the root of your helm Chart location, and then create a config map from that file and mount it to the deployment accordingly to your needs.</p>

<p>In case you are not using helm you can create the config map from a file directly using a kubectl command (took from this reference <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#create-configmaps-from-files" rel="noreferrer">config map from file command</a>):</p>

<p><strong>create a config map from file with no helm:</strong></p>

<pre><code>kubectl create configmap phpini-configmap --from-file=configure-pod-container/configmap/php.ini
</code></pre>

<p><strong>config map YAML when using helm would look similar to:</strong></p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: phpini-configmap
data:
  php.ini: |-
{{ .Files.Get "conf/php.ini" | indent 4 }}
</code></pre>

<p>The pod should then consume this config map and mount it to the right path</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: test-pod
  namespace: default
spec:
  containers:
    - name: php-container
      image: k8s.gcr.io/busybox
      command: [ "/bin/sh", "-c", "cat /etc/config/php.ini" ]
      volumeMounts:
      - name: ini-configmap
        mountPath: /etc/config/php.ini
        subPath: php.ini
      env:
      - name: PHP_INI_PATH
        value: /etc/config/php.ini
  volumes:
    - name: ini-configmap
      configMap:
        name: phpini-configmap
</code></pre>
