You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
KubernetesExecutor async pod creation never refreshes exec plugin tokens #74306
With async_pod_creation = True and a kubeconfig that authenticates through an exec plugin (e.g. EKS), pod creation keeps sending the first token after it expires, so it fails with 401 until the scheduler restarts.
The sync client is fine because kubernetes installs a refresh_api_key_hook. kubernetes_asyncio doesn't, and the async client is built once and cached (kubernetes_executor_utils.py:714).
What you think should happen instead
The async client refreshes its token the same way the sync one does.
How to reproduce
Use an exec plugin kubeconfig with short-lived tokens, enable async_pod_creation, and let the scheduler run past the first token's expiry.
cncf-kubernetes 10.23.0, kubernetes 36.0.3, kubernetes_asyncio 36.1.0. Happy to submit a PR.
From the description, it looks like the async client path used for pod
creation [in <file/function named in the issue>] loads the kubeconfig once,
so when an exec-based credential plugin's token expires, subsequent
requests keep using the stale token instead of re-running the exec command.
My plan:
Reproduce it with a unit test that mocks an exec credential with a short
expiry and asserts the token is refreshed on the next call.
Fix the async path so it refreshes exec credentials the same way the
sync client does [adjust if the issue suggests a different approach].
Keep the PR scoped to this bug, with tests.
I'll open a draft PR once I have a failing test. Happy to adjust if a
maintainer prefers a different approach. @seanghaeli you mentioned you might open a PR. Happy to step back if you’ve already started, otherwise I’ll take this one.
Activity
AnushreeKasturi commentedon Oct 9, 2026
Hi! I'd like to work on this.
From the description, it looks like the async client path used for pod
creation [in <file/function named in the issue>] loads the kubeconfig once,
so when an exec-based credential plugin's token expires, subsequent
requests keep using the stale token instead of re-running the exec command.
My plan:
expiry and asserts the token is refreshed on the next call.
sync client does [adjust if the issue suggests a different approach].
I'll open a draft PR once I have a failing test. Happy to adjust if a
maintainer prefers a different approach.
@seanghaeli you mentioned you might open a PR. Happy to step back if you’ve already started, otherwise I’ll take this one.
seanghaeli commentedon Oct 9, 2026
Hi @AnushreeKasturi, thanks! Go for it! The relevant spot is:
airflow/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py
Lines 722 to 724 in 8e14de6