OK this is a bit of a hack. But lets say you want to be editing files in a directory. Each time you write one, you want it synced into some container. This is obviously for development purposes. Well I present the below hacklet. It uses the
inotifycall of Linux, watching the current directory. Each time a file is written, in my example, it calls docker cp. Feel free to make that kubectl cp or another action.
Warranty void where prohibited.
inotifywait -m $PWD -e modify | while read path action file do echo sync $file docker cp $file CONTAINER:PATH/ done