<p>env.example</p>
<pre><code>MYSQL_PASSWORD=password
MYSQL_DATABASE=db
MYSQL_ROOT_PASSWORD=password
MYSQL_USER=user
</code></pre>
<p>I created secret</p>
<pre><code>kubectl create secret generic prod-secrets --from-file=env.example
</code></pre>
<p>Specified secret in mysql yaml file</p>
<pre><code>spec:
      containers:
      - name: mysql-container
        image: mysql:dev
        imagePullPolicy: &quot;IfNotPresent&quot;
        envFrom:
          - secretRef:
             name: prod-secrets
        ports:
        - containerPort: 3306
         # container (pod) path
        volumeMounts:
          - name: mysql-persistent-storage
            mountPath: /data/db
</code></pre>
<p>Pod goes into <code>CrashLoopBackOff</code></p>
<p>This is from <code>kubectl describe pod</code></p>
<blockquote>
<p>Environment Variables from:</p>
<p>prod-secrets  Secret  Optional: false</p>
<p>Environment:    </p>
</blockquote>
<p>What's wrong with this setup ?</p>
<p>Secret output:</p>
<pre><code>kubectl describe secret prod-secrets
Name:         prod-secrets
Namespace:    default
Labels:       &lt;none&gt;
Annotations:  &lt;none&gt;

Type:  Opaque

Data
====
env.example:  96 bytes
</code></pre>
<p><strong>EDIT</strong></p>
<p>After trying suggestion from answer, pod still crashing</p>
<pre><code>mysql-container-ffdc44fc6-w9qqm     0/1     Error     1          23s
mysql-container-ffdc44fc6-w9qqm     0/1     CrashLoopBackOff   1          34s
mysql-container-ffdc44fc6-w9qqm     1/1     Running            2          34s
mysql-container-ffdc44fc6-w9qqm     0/1     Error              2          44s
mysql-container-ffdc44fc6-w9qqm     0/1     CrashLoopBackOff   2          56s
mysql-container-ffdc44fc6-w9qqm     1/1     Running            3          72s
mysql-container-ffdc44fc6-w9qqm     0/1     Error              3          82s
</code></pre>
<p>Secret is shown correctly</p>
<pre><code>kubectl describe secret prod-secrets
Name:         prod-secrets
Namespace:    default
Labels:       &lt;none&gt;
Annotations:  &lt;none&gt;

Type:  Opaque

Data
====
MYSQL_DATABASE:       7 bytes
MYSQL_PASSWORD:       8 bytes
MYSQL_ROOT_PASSWORD:  8 bytes
MYSQL_USER:           4 bytes
</code></pre>
<p>I'm running only 1-node cluster (1 master node), can this cause this issue ?</p>
<p>Found and issue:</p>
<p>specified root as DB_USER in env file, once i changed it all started working</p>

overflowed
<p>Create the secret using the option <strong>--from-env-file</strong></p>

<pre><code>kubectl create secret prod-secrets \
       --from-env-file=env.example
</code></pre>
