Skip to content

EksPodOperator deferrable mode fails on remote triggerers — credential temp file not available #61736

Closed

Description

@andrewhharmon

Apache Airflow Provider(s)

amazon

Versions of Apache Airflow Providers

apache-airflow-providers-amazon==9.18.0

Apache Airflow version

3..x.x

Operating System

Debian/Ubuntu-based containers (Astronomer Runtime, official Airflow images)

Deployment

Astronomer

Deployment details

Any deployment where the triggerer runs on a different host than the worker (Astronomer, MWAA, distributed Airflow with separate triggerer pods).

What happened

EksPodOperator with deferrable=True fails with 401 Unauthorized when the triggerer runs on a separate host from the worker (e.g., Astronomer, MWAA).

The root cause is that the credential temp file created during execute() is not available on the triggerer when it tries to poll the pod.

The credential lifecycle during deferral:

  1. EksPodOperator.execute() calls eks_hook.get_session() to extract AWS credentials
  2. _secure_credential_context() writes them to a temp file on the worker (e.g., /tmp/tmpXYZ)
  3. generate_config_file() creates a kubeconfig with an exec block that references that temp file:
    users:
      - name: aws
        user:
          exec:
            command: sh
            args: ["-c", ". /tmp/tmpXYZ; python -m airflow...utils.eks_get_token ..."]
  4. KubernetesPodOperator.invoke_defer_method() calls convert_config_file_to_dict(), which reads the kubeconfig into a dict — including the exec block with the temp file path
  5. The task defers, the context managers exit, and both temp files are deleted (the credential file and the kubeconfig file)
  6. The trigger is serialized to the metadata DB with config_dict containing the now-stale temp file path
  7. The triggerer (on a different host) deserializes the trigger and calls load_kube_config_from_dict(config_dict)
  8. kubernetes_asyncio processes the exec block and runs sh -c ". /tmp/tmpXYZ; ..."
  9. /tmp/tmpXYZ doesn't exist on the triggerer → credentials not loaded → 401 Unauthorized

Error output:

kubernetes_asyncio.client.exceptions.ApiException: (401)
Reason: Unauthorized
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure",
"message":"Unauthorized","reason":"Unauthorized","code":401}

Note: This is a separate issue from #60269 (POSIX shell compatibility). Even with the . fix from that issue, the credential temp file still won't exist on the triggerer.

Note: The trigger_reentry() path works correctly because it generates fresh credentials on the worker when the trigger fires. The problem is only during the triggerer's polling phase.

What you think should happen instead

The exec block in the serialized config_dict should not depend on temp files that only exist on the worker.

How to reproduce

  1. Deploy Airflow with a triggerer running on a separate host from the worker (Astronomer, MWAA, or distributed Helm deployment with dedicated triggerer pods)
  2. Configure an EksPodOperator with deferrable=True connecting to an EKS cluster
  3. Run the DAG
  4. The pod launches successfully (worker has valid credentials)
  5. The task defers to the triggerer
  6. The triggerer fails to poll the pod with 401 Unauthorized

Anything else

I used AI tools to help troubleshoot this and my understanding is still limited. Hoping some discussion can help determine the correct fix for which I'm happy to help with.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. Codingaditya17 commented on Feb 10, 2026

    @Codingaditya17
    Contributor

    Thanks for the detailed and clear issue description.

    I’d like to work on this. I’m currently going through the deferrable execution path and how credentials are serialized between the worker and trigger. I’ll share a proposed approach here before opening a PR to make sure it aligns with expectations.

  2. andrewhharmon commented on Feb 10, 2026

    @andrewhharmon
    ContributorAuthor

    Great, thanks. You may want to look at this issue as well to see if it's related. #61737

  3. Codingaditya17 commented on Feb 10, 2026

    @Codingaditya17
    Contributor

    I’ve submitted a PR addressing the related exec-based auth caching issue in #61737.

    If no one is actively working on this issue, I’m happy to look into it.

  4. removed
    needs-triagelabel for new issues that we didn't triage yet
    on Feb 10, 2026
  5. amankum2004 commented on Feb 14, 2026

    @amankum2004

    @andrewhharmon Sir, if no one is working on this issue, can i work on this ?
    Can it be assigned to me ?

  6. andrewhharmon commented on Mar 3, 2026

    @andrewhharmon
    ContributorAuthor

    im not sure sounds like @Codingaditya17 said he'd take a look

  7. added 4 commits that reference this issue on Mar 7, 2026
    5d4a225
    fdad29e
    dc9c61f
    fdcfda5
  8. added 2 commits that reference this issue on Mar 16, 2026
    a90dcd7
    a7cfbd0
  9. mattwang44 commented on Oct 19, 2026

    @mattwang44
    Contributor

    This should be fixed on main by #64187 (amazon provider 9.25.0). EksPodOperator.invoke_defer_method now defers to the new EksPodTrigger, which fetches fresh AWS credentials and regenerates the kubeconfig on the triggerer itself, so the triggerer no longer depends on the worker's temp file. test_run_generates_fresh_kubeconfig covers this path.

    Could someone confirm on a split worker/triggerer deployment and close this?


    Drafted-by: Claude Code (Opus 5.5); reviewed by @mattwang44 before posting

  10. linked a pull request that will close this issueAdd a new EKS specific Triggerer #64187on Nov 6, 2026
  11. shahar1 commented on Nov 6, 2026

    @shahar1
    Contributor

    Solved by #64187

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions