<p>I use minikube on windows 10 and try to test Kubernetes ConfigMap with both literal type and outer file type. First I make below manifest yaml file to make ConfigMap.</p>

<pre><code>apiVersion: v1
kind: ConfigMap  
metadata:
  name: simple-config
data:  
  mysql_root_password: password
  mysql_password: password
  mysql_database: test

---
apiVersion: v1
kind: Pod
metadata:
  name: blog-db  
  labels:
    app: blog-mysql  
spec:
  containers:
  - name: blog-mysql
    image: mysql:latest
    env:  
      - name: MYSQL_ROOT_PASSWORD
        valueFrom: 
          configMapKeyRef:
            name: simple-config
              key: mysql_root_password
      - name: MYSQL_PASSWORD
        valueFrom: 
          configMapKeyRef:
            name: simple-config 
            key: mysql_password
      - name: MYSQL_DATABASE
        valueFrom: 
          configMapKeyRef:
            name: simple-config
            key: mysql_database
    ports:
      - containerPort: 3306
</code></pre>

<p>The above configmap yaml file throws no errors. It works successfully. This time I try to test kubernetes configmap with file.</p>

<p><strong>== configmap.properties</strong></p>

<pre><code>mysql_root_password=password
mysql_password=password
mysql_database=test
</code></pre>

<p>But I am stuck with this part. Most of configmap examples use kubectl command with --from-file option like below,</p>

<pre><code>kubectl create configmap simple-config --from-file=configmap.properties
</code></pre>

<p>But I have no idea how to mount the properties file using manifest yaml file grammer. Any advice?</p>

Joseph Hwang
<p>You can not directly mount a properties file in a pod without first creating a ConfigMap from the properties file.You can create configMap from env file as below</p>

<pre><code>kubectl create configmap simple-config \
       --from-env-file=configmap.properties
</code></pre>
