<p>I am trying to deploy nats in k8s cluster. I need to override default server config.
Tried creating a configmap with --from-file and attached it to deployment, but it gives me the following error</p>
<pre><code>nats-server: read /etc/nats-server-conf/server.conf: is a directory
</code></pre>
<p>ConfigMap</p>
<pre><code>k describe configmaps nats-server-conf
</code></pre>
<pre><code>Name:         nats-server-conf
Namespace:    default
Labels:       &lt;none&gt;
Annotations:  &lt;none&gt;

Data
====
server.conf:
----
accounts: {
  \$SYS: {
    users: [{user: sys, password: pass}]
  }
}

BinaryData
====

Events:  &lt;none&gt;
</code></pre>
<p>Following is my deployment file</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: nats-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nats
  template:
    metadata:
      labels:
        app: nats
    spec:
      containers:
        - name: nats
          image: nats
          volumeMounts:
          - mountPath: /etc/nats-server-conf/server.conf
            name: nats-server-conf
          args:
            [
              '-p',
              '4222',
              '-m',
              '8222',
              '-js',
              '-c',
              '/etc/nats-server-conf/server.conf'
            ]
      volumes:
      - configMap:
          name: nats-server-conf
        name: nats-server-conf
</code></pre>
<p>Thank you.</p>

Shreyas Chorge
<pre><code>- mountPath: /etc/nats-server-conf/server.conf
</code></pre>
<p>The above setting will make a Pod mount <code>server.conf</code> as a directory, so try the below instead:</p>
<pre><code>- mountPath: /etc/nats-server-conf
</code></pre>
