I tried to use configMap to mount some configs in a subdirectory. For example:
spec.template.spec.containers.[0].volumeMounts:
- name: fh16-volume
mountPath: /etc/fh-16/application.log
subPath: my-config.txt
spec.template.spec.volumes:
- name: fh16-volume
configMap:
name: my-config
At this scenario, all mount as expected. But after any changes in configMap, this changes not applied in a container. Need to recreate pod for this.
It looks like some bug, but maybe I make some mistake in my configurations? In the case when I don't use subPath directive, all works as expected.
It looks like some bug
Yes, it is: https://github.com/kubernetes/kubernetes/issues/50345
This is currently expected behavior. kubelet update the content inside container on a timer.
See this note in the Kubernetes docs:
Note: A container using a ConfigMap as a subPath volume mount will not receive ConfigMap updates."