-
Notifications
You must be signed in to change notification settings - Fork 39.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: inotify behavior on atomic configMap/secret volumes is not documented #112677
Comments
@ahmetb: The label(s) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@ahmetb: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/remove-label bug |
@ahmetb: The label(s) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Nits:
It's a "normal file system", the behavior is entirely in file manipulation in ways that can happen on any filesystem. (I get this is mostly semantics, but that matters for the docs!) Code that only triggers on IN_CLOSE_WRITE can be broken by this technique outside of Kubernetes. using
https://www.gnu.org/software/libc/manual/html_node/Renaming-Files.html#Renaming-Files https://lwn.net/Articles/789600/ has a discussion of even adding new ways for applications to do this. I do think this is something we should mention that simple inotify probably won't work, but I'm not sure we should document the implementation details vs suggesting reliable alternatives that don't depend on the implementation (like periodically reading and diffing vs the last read). I also wouldn't be surprised to see other systems leveraging this known-technique outside kubernetes for the same reason Kubernetes does ... to prevent the even worse pitfall of clients reading partially-rewritten content. |
/sig node storage |
The main problem is the class of programs reloading configuration based on the filesystem writes that are probably handling a "delete" event by printing an error saying "configuration file no longer exists, exiting" and subsequently issuing an exit() redundantly (whereas they could just attempt to retry the watch). |
Agree that this is true, however pointing out that behavior is already a broken approach outside of Kubernetes, as the atomic file swap technique is general to Linux and can be done by hand even with just A lot of programs probably don't handle this properly and may encounter it first on Kubernetes. I agree we should warn people, but I disagree that it's only on Kubernetes or result of a special filesystem. It's broken usage of inotify either way. * so long as both files are on the same disk/filesystem, |
/remove-kind bug |
I don't think this is important to document. If you're able to do something misguided without using Kubernetes, we typically don't document that Kubernetes continues to make that possible. The list of caveats could be very very long! If we commit to using If that commitment is not part of defined Kubernetes conformance, I'm even more wary of documenting the detail. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close not-planned |
@k8s-triage-robot: Closing this issue, marking it as "Not Planned". In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Background:
Kubernetes automatically updates files on mounted
secret
andconfigMap
volume types, as respective Secret/ConfigMap resources change.Problem:
When someone runs a program on Kubernetes watching filesystem updates on
secret
andconfigMap
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
The text was updated successfully, but these errors were encountered: