-
Notifications
You must be signed in to change notification settings - Fork 42.2k
Description
Background:
Kubernetes automatically updates files on mounted secret and configMap volume types, as respective Secret/ConfigMap resources change.
Problem:
When someone runs a program on Kubernetes watching filesystem updates on secret and configMap volume types volumes (which is typically done using inotify(7) syscall on POSIX systems), they will be getting only "file deleted" (IN_DELETE_SELF) inotify event when the files are updated. (This is because how Kubernetes/kubelet uses AtomicWriter to make updates to these files.)
This behavior is quite different than what the program would see when it's running outside Kubernetes, since a normal filesystem would return inotify events like IN_CLOSE_WRITE (file opened for writing closed) or IN_MODIFY (file written) events. Furthermore, "file deleted" event causes the inotify monitor to break. Therefore, the code needs to handle this to re-establish the inotify watch upon deletion (otherwise it would only receive the one delete event, and nothing else).
This caveat is not documented.
Solution:
Since this behavior might break existing programs that watch files when the program is migrated to run on Kubernetes, it would be ideal to note this pitfall in the project documentation (this page?).
It currently seems that this information is tucked away in some blog posts [1], [2], [3] and would be good to surface in official documentation as well.
/kind bug
/area docs