What if you want to mount a configuration file from a ConfigMap, but do not want to mount it as a volume? You can accomplish this by using SubPaths...
For further actions, you may consider blocking this person and/or reporting abuse
I tried your steps with OpenShift v4.19 (Kubernetes 1.19) and it didn't work. The directory (which is a Tomcat 9 deployment) is still overwritten by the single file (logback.xml) in the volume
and in the deployment config:
Do you have any idea why this is not working?
I have followed the method mentioned in the blog and it is working. Thanks for this really useful content. But I am facing one issue now which is mentioned below.
I have a kind: Deployment as below where I am mounting rs-config.yaml ConfigMap(which contains a ss.yml file) as volume. With the below configuration I am able to get the ss.yml file in the specified mountPath: C:................\App_Data
Apart from ss.yml I need another directory named DATA in the same path(C:................\App_Data) for which I used the subPath. With the below code I am able to get DATA directory but the contents in the DATA directory are not getting completely copied(subdirectories and some files are missing which are required for our application to be up).
name: volume-rsconfigMap:
name: rs-config
items:
key: ss.yml
path: remote/AppData/
containers:
name: remote
image: registry_name
volumeMounts:
name: volume-rs
mountPath: C:................\App_Data\ss.yml
subPath: remote/AppData/
Can anyone suggest a workaround for this? Any help would be grateful. Thanks in advance.
Appreciated well explained.
I think there's a typo, you config map is named: mysql-config but you always seem to reference: mysql-configmap in the deployment
great catch, indeed a typo. I appreciate you taking the time to point that out. I've updated the configmap name to mysql-configmap. :)
I believe you don't have to list the items inside the volume for it to work.