Repository navigation
Description
Apache Airflow Provider(s)
amazon
Versions of Apache Airflow Providers
9.7.0
Apache Airflow version
3.0.0
Operating System
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
Deployment
Astronomer
Deployment details
We use astronomer. this seemed to work ok with local dev but not when deployed to the cluster. Perhaps that's bc of different executor being used locally vs being deployed?
What happened
After upgrading to Airflow 3.0, the EksPodOperator started failing. It appears that its hook fails to fetch a token to auth to the K8s Server. This is bc the mechanism for fetching the token runs a script in a sub process. This script import the airflow hook. Bc it's in a separate process, it runs the airflow initialization step and fails initializing the database.
| from airflow.providers.amazon.aws.hooks.eks import EksHook |
What you think should happen instead
Properly fetch a token and connect to EKS
How to reproduce
Use the EKSPodOperator to run an Airflow task.
Anything else
As a workaround I created a custom hook/operator that doesn't use this script, but instead uses the aws cli python library to fetch the token. This works but requires the added dependency.
Also, I know Airflow technically isn't supported on MacOs, but the grep command used to create the Kubeconfig file uses the -P flag which isn't supported on MacOs. This made troubleshooting difficult as that was a red hearing.. but again, macOS isn't technically supported.
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
boring-cyborg commentedon May 19, 2025
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
andrewhharmon commentedon May 19, 2025
oh, I also tried setting the env
_AIRFLOW__AS_LIBRARYfor the subprocess running the script. It got passed the db error, but failed on something about plugins dir and at that point wasn't sure what else to try.andrewhharmon commentedon May 19, 2025
it also appeared that a
kuberentes_defaultconnection was required even though in reality it shouldn't use that it uses an aws connection. perhaps worth taking a look at that as well?gopidesupavan commentedon May 20, 2025
Can you set this env variable os.environ["PYTHON_OPERATORS_VIRTUAL_ENV_MODE"] = "1" see if that works ? I will have to look eks, will check it soon not in next two days.
o-nikolas commentedon May 30, 2025
I tried this, and perhaps I didn't put it in the right spot, but the tests still fail 😢
gopidesupavan commentedon Jun 2, 2025
ah unfortunately dont have eks to try and test.
The idea is to not initialise the db session, we have this issue one of the python operators and introduced that variable which will prevent re initialisation here https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/settings.py#L618
gopidesupavan commentedon Jun 2, 2025
Any error your getting ?
may be you could put that in here https://github.com/apache/airflow/blob/main/providers/amazon/src/airflow/providers/amazon/aws/utils/eks_get_token.py#L64 ?
o-nikolas commentedon Jun 3, 2025
Fixed in #51333