<p>In Kubernetes, I have the following section in deployment.yaml. I am using ConfigMap and I want to set the path dynamically based on the pod metadata or label or env variable in pod. Does ConfigMap support setting path dynamically?</p>
<pre><code>spec:
                  volumes:
                    - name: configmap
                      configMap:
                        name: devconfig
                        items:
                          - key: config
                            path: $(ENVIRONMENT)
                        defaultMode: 420
</code></pre>

developthou
<p>This is call substitution which kubectl does not support out of the box. However, you can easily achieve what you want by using <a href="https://stackoverflow.com/questions/14155596/how-to-substitute-shell-variables-in-complex-text-files">envsubst</a> command which will substitute <code>$ENVIRONMENT</code> in your yaml with the the environment variable set in your current shell.</p>
