<p>I have a <code>secret.yaml</code> file inside the templates directory with the following data:</p>

<pre><code>apiVersion: v1
kind: Secret
metadata: 
  name: appdbpassword
stringData:
  password: password
</code></pre>

<p>I also have a ConfigMap:</p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: appdbconfigmap
data:
  jdbcUrl: jdbc:oracle:thin:@proxy:service
  username: bhargav
</code></pre>

<p>I am using the following pod:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: expense-pod-sample-1
spec:
  containers:
    - name: expense-container-sample-1
      image: exm:1
      command: [ "/bin/sh", "-c", "--" ]
      args: [ "while true; do sleep 30; done;" ]
      envFrom:
      - configMapRef:
              name: appdbconfigmap
      env:
      - name: password
        valueFrom:
          secretKeyRef:
            name: appdbpassword
            key: password
</code></pre>

<p>When I use the helm install command I see the pod running but if I try to use the environment variable <code>${password}</code> in my application, it just does not work. It says the password is wrong. It does not complain about the username which is a ConfigMap. This happens only if I use helm. If I don't use helm and independently-run all the YAML files using kubectl, my application access both username and password correctly.</p>

<p>Am I missing anything here ?</p>

Bhargav Behara
<pre><code>apiVersion: v1
kind: Secret
metadata:
  name: test-secret
data:
  password : cGFzc3dvcmQK
</code></pre>

<p>You can also add the secret like this where converting data into base64 format. While stringData do it automatically when you create secret.</p>

<p>Trying Adding the secrets in environment like this way</p>

<pre><code>envFrom:
        - secretRef:
            name: test-secret
</code></pre>
