<p>I have 2 pods that use the same pvc to mount a pv so that they can share files through the mounted directory. Pod A has a Java Application that watches for new files (using java.nio.file.WatchService) in the mounted directory, but if pod B creates/renames/moves/etc. a file to this directory, it shows up on the volume and in pod A but doesn't fire an according event. When I rename or do anything with the file in pod A it gets recognized directly.
The storage system is gluster-fs on a local kubernetes cluster.</p>

Jefski14
<p>The reason for this behavior is that the Java WatchService can't ensure that file events are correctly generated when using a volume through a <strong>bind mount</strong>.</p>
<p>This article goes in great depth to why this is the case: <a href="https://blog.arkey.fr/2019/09/13/watchservice-and-bind-mount/" rel="nofollow noreferrer">https://blog.arkey.fr/2019/09/13/watchservice-and-bind-mount/</a></p>
<p>The simplest solution to this problem is to check for new files periodically.</p>
