rjgoyln opened a new pull request, #72300: URL: https://github.com/apache/airflow/pull/72300
## Summary `AsyncKubernetesHook` caches the kubeconfig it loads, and both the pod and job triggers hold that hook as a `cached_property`. Exec credential plugins such as `aws eks get-token` mint tokens that expire in about fifteen minutes, so the cache pins an expired token for the life of the trigger and a deferrable task watching a long-running pod starts failing with 401 Unauthorized part-way through. #65212 stopped caching for exec auth reached through `config_dict`, `kube_config` and `kube_config_path`, but left the fall-through branch — the kubeconfig `kubernetes_asyncio` loads from `~/.kube/config` or `$KUBECONFIG`. A deployment lands there when the operator sets no `config_file`, the worker has no `KUBECONFIG`, and the connection carries neither kubeconfig field, which is what mounting an EKS kubeconfig at the default location looks like. Those users still hit the original bug. That branch now makes the same decision as the others, so only static credentials stay cached. When `$KUBECONFIG` names several existing files, deciding which user is active is `kubernetes_asyncio`'s job; the config is left uncached instead of reimplementing the merge rules here, which costs one re-read per poll and nothing else. In-cluster configuration still caches — `load_incluster_config()` installs a `refresh_api_key_hook` that re-reads the rotated service account token. closes: #61737 --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Opus 5) Generated-by: Claude Code (Opus 5) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
