<p>I'm deploying a test application onto kubernetes on my local computer (minikube) and trying to pass database connection details into a deployment via environment variables.</p>
<p>I'm passing in these details using two methods - a <code>ConfigMap</code> and a <code>Secret</code>. The username (<code>DB_USERNAME</code>) and connection url (<code>DB_URL</code>) are passed via a <code>ConfigMap</code>, while the DB password is passed in as a secret (<code>DB_PASSWORD</code>).</p>
<p>My issue is that while the values passed via <code>ConfigMap</code> are fine, the <code>DB_PASSWORD</code> from the secret appears jumbled - like there's some encoding issue (see image below).</p>
<p><a href="https://i.stack.imgur.com/jmB4W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jmB4W.png" alt="DB_PASSWORD not showing up properly" /></a></p>
<p>My deployment yaml</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx
  name: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx
        name: nginx
        envFrom:
        - configMapRef:
            name: gweb-cm
        - secretRef:
            name: password

</code></pre>
<p>My <code>ConfigMap</code> and <code>Secret</code> yaml</p>
<pre><code>apiVersion: v1
data:
  DB_URL: jdbc:mysql://mysql/test?serverTimezone=UTC
  DB_USERNAME: webuser
  SPRING_PROFILES_ACTIVE: prod
  SPRING_DDL_AUTO: create
kind: ConfigMap
metadata:
  name: gweb-cm
---
apiVersion: v1
kind: Secret
metadata:
  name: password
type: Generic
data:
  DB_PASSWORD: test

</code></pre>
<p>Not sure if I'm missing something in my Secret definition?</p>

tvicky4j247
<p>The secret value should be base64 encoded. Instead of <code>test</code>, use the output of</p>
<pre class="lang-bash prettyprint-override"><code>echo -n 'test' | base64
</code></pre>
<p>P.S. the Secret's type should be <code>Opaque</code>, not <code>Generic</code></p>
