title: Import data to config map from kubernetes secret
body: <p>I'm using a kubernetes ConfigMap that contains database configurations for an app and there is a secret that has the database password.
  I need to use this secret in the ConfigMap so when I try to add environment variable in the ConfigMap and specify the value in the pod deployment from the secret I'm not able to connect to mysql with password as the values in the ConfigMap took the exact string of the variable.</p>
  
  <pre><code>apiVersion: v1
  kind: ConfigMap
  metadata:
    name: config
  data:
    APP_CONFIG: |
      port: 8080
      databases:
        default:
          connector: mysql
          host: "mysql"
          port: "3306"
          user: "root"
          password: "$DB_PASSWORD"
  </code></pre>
  
  <p>and the deployment.yaml</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: app
    labels:
      app: backend
  spec:
    replicas: 1
    template:
      metadata:
        labels:
          app: backend
      spec:
        containers:
        - name: app
          image: simple-app-image
          ports:
            - name: "8080"
              containerPort: 8080
          env:
            - name: APP_CONFIG
              valueFrom:
                configMapKeyRef:
                  name: config
                  key: APP_CONFIG
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: "mysql-secret"
                  key: "mysql-root-password"
  </code></pre>
  
  <p>Note: the secret exist and I'm able to get "mysql-root-password" value and use to login to the database</p>