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
nats-server: read /etc/nats-server-conf/server.conf: is a directory
ConfigMap
k describe configmaps nats-server-conf
Name: nats-server-conf
Namespace: default
Labels: <none>
Annotations: <none>
Data
====
server.conf:
----
accounts: {
\$SYS: {
users: [{user: sys, password: pass}]
}
}
BinaryData
====
Events: <none>
Following is my deployment file
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
Thank you.
- mountPath: /etc/nats-server-conf/server.conf
The above setting will make a Pod mount server.conf
as a directory, so try the below instead:
- mountPath: /etc/nats-server-conf