<p>I want to configure passwords in the config map.YAML instead of deployment.yaml.able to set username and other variables.attcahing the config map.YAML file which I worked on.</p>

<pre><code>kind: ConfigMap
apiVersion: v1
metadata:
  name: poc-configmapconfiguration-configmap
data:
  Environment: [[.Environment]]
  dockerRegistryUrl: [[.Env.dockerRegistryUrl]]
  CassandraSettings__CassandraPassword:
          valueFrom:
             secretKeyRef:
                name: abcd-passwords
                key: "[[ .Environment ]]-abcd-cassandra-password
</code></pre>

Riby Varghese
<p>As already suggested its <strong>better practice to use secrets to store passwords</strong> 
<strong>Secrets obscure your data using a Base64 encoding</strong> so it is good practice to use Secrets for confidential data over using ConfigMaps.</p>

<p>If you perform a explain on ConfigMap field to get more details from CLI it self on the ConfigMap.data it accepts map of strings.</p>

<pre><code>$ kubectl explain ConfigMap.data
KIND:     ConfigMap
VERSION:  v1

FIELD:    data &lt;map[string]string&gt;

DESCRIPTION:
     Data contains the configuration data. Each key must consist of alphanumeric
     characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use
     the BinaryData field. The keys stored in Data must not overlap with the
     keys in the BinaryData field, this is enforced during validation process.
</code></pre>

<p>So above <strong>yaml structure you used should throw a error on creation time</strong> something like below ..</p>

<pre><code>invalid type for io.k8s.api.core.v1.ConfigMap.data
</code></pre>

<p><strong>Refer this git request for such feature request , which is already closed with no support considered.</strong></p>

<p><a href="https://github.com/kubernetes/kubernetes/issues/79224" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/79224</a></p>
