class
Kubernetes::TokenFileWatcher
- Kubernetes::TokenFileWatcher
- Reference
- Object
Overview
Watches a token file for changes using inotify (Linux only). Caches the token in memory and reloads it when Kubernetes rotates the projected service account token.
Kubernetes uses an atomic symlink swap for token rotation:
- Creates new timestamped directory with updated token
- Uses MOVED_TO to swap ..data symlink to new directory
- Deletes old directory
We watch the parent directory for MOVED_TO events on ..data to catch rotation.