Skip to content

docs: inotify behavior on atomic configMap/secret volumes is not documented #112677

@ahmetb

Description

@ahmetb

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/documentationCategorizes issue or PR as related to documentation.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.sig/docsCategorizes an issue or PR as relevant to SIG Docs.sig/nodeCategorizes an issue or PR as relevant to SIG Node.sig/storageCategorizes an issue or PR as relevant to SIG Storage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions