<p>I have a config file inside a config folder i.e console-service.yml. I am trying to load at runtime using configMap, below is my deployment yml:</p>

<pre><code>kind: Deployment
apiVersion: apps/v1
metadata:
  name: consoleservice
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: consoleservice
    spec:
      containers:
      - name: consoleservice
        image: docker.example.com/app:1
        volumeMounts:
        - name: console-config-volume
          mountPath: /config/console-server.yml
          subPath: console-server.yml
          readOnly: true
      volumes:
      - name: console-config-volume
        configMap:
          name: console-config



kind: ConfigMap
apiVersion: v1
metadata:
  name: consoleservice
data:
  pool.size.core: 1
  pool.size.max: 16
</code></pre>

<p>I am new to configMap. How I can read .yml configuration from <code>config/</code> location?</p>

Chintamani
<p>There are two possible solutions for your problem.</p>

<p><strong>1. Embedd your File directly into the ConfigMap</strong><br>
This coul look similar to this:</p>

<pre><code>kind: ConfigMap
apiVersion: v1
metadata:
  name: some-yaml
file.yaml: |
  pool:
    size:
      core: 1
      max: 16
</code></pre>

<p><strong>2. Create a ConfigMap from your YAML-File</strong><br>
Would be done by using kubectl:</p>

<pre><code>kubectl create configmap some-yaml \
  --from-file=./some-yaml-file.yaml
</code></pre>

<p>This would create a ConfigMap containg the selected file. You can add multiple files to a single ConfigMap.</p>

<p>You can find <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/" rel="nofollow noreferrer">more informations in the Documentation</a>.</p>
