I am having two different config maps test-configmap and common-config. I tried to mount them at the same location, but one config map over
Another example of how this can be done for mounting multiple configmaps. This for an nginx dock were you want to both replace the main /etc/nginx/nginx.conf and the files in /etc/nginx/conn.f. This also deletes the default.conf file in conf.d
containers:
- name: nginx-proxy
image: nginx:1.16-alpine
imagePullPolicy: Always
ports:
- containerPort: 443
- containerPort: 80
volumeMounts:
- name: nginx-main-conf-file
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
- name: nginx-site-conf-file
mountPath: /etc/nginx/conf.d
volumes:
- name: nginx-main-conf-file
configMap:
name: nginx-main-conf
- name: nginx-site-conf-file
configMap:
name: nginx-site-conf
And one very important point. If you have any out commented lines (# something) in your yaml file, then this will not work. It's a bug. Tested in kubectl v1.14