-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KubernetesExecutor does not work with exec authentication on kubernetes client >= 22.6.0 #22560
Comments
Thanks for opening your first issue here! Be sure to follow the issue template! |
I did a bit more of debugging, it seems that the error is not specific to kubelogin and a much more general problem. I am renaming the ticket as it has little to do with kubelogin and Azure. I found this in the logs:
I am using the following version of
Here's the relevant diff in the upstream: kubernetes-client/python@1c5bf58 So it seems like this API breaks in v22.6.0. Changing
to status = ExecProvider(self._user['exec'], os.getcwd()).run() resolves the issue. |
@dszakallas can you open PR with the suggested fix? |
That might be another one (@ephraimbuddy @dstandish) that might make 2.2.5 needing an RC2 |
@dszakallas, not sure what version of the kubernetes provider you have, but try with this combo:
Basically, 2.2.4 only works with |
I'll also add, you should be using constraints, which gets you on versions all tested together: That would have gotten you |
closing for the following reasons this issue should be resolved by using constraints file as suggested by @jedcunningham And from airflow 2.3.0, we remove anyway the “refresh configuration” code that is the problem here. |
Kubernetes and Celery are both providers and part of the core. The dependencies for both are added via "extras" which makes them "soft" limits and in case of serious dependency bumps this might end up with a mess (as we experienced with bumping min K8S library version from 11.0.0 to 22.* (resulting in yanking 4 versions of `cncf.kubernetes` provider. After this learning, we approach K8S and Celery dependencies a bit differently than any other dependencies. * for Celery and K8S (and Dask but this is rather an afterhought) we do not strip-off the dependencies from the extra (so for example [cncf.kubernetes] extra will have dependencies on both 'apache-airflow-providers-cncf-kubernetes' as well as directly on kubernetes library * We add upper-bound limits for both Celery and Kubernetes to prevent from accidental upgrades. Both Celery and Kubernetes Python library follow SemVer, and they are crucial components of Airlfow so they both squarely fit our "do not upper-bound" exceptions. * We also add a rule that whenever dependency upper-bound limit is raised, we should also make sure that additional testing is done and appropriate `apache-airflow` lower-bound limit is added for the `apache-airflow-providers-cncf-kubernetes` and `apache-airflow-providers-celery` providers. That should protect our users in all scenarios where they might unknowingly attempt to upgrade Kubernetes or Celery to incompatible version. Related to: apache#22560, apache#21727
Kubernetes and Celery are both providers and part of the core. The dependencies for both are added via "extras" which makes them "soft" limits and in case of serious dependency bumps this might end up with a mess (as we experienced with bumping min K8S library version from 11.0.0 to 22.* (resulting in yanking 4 versions of `cncf.kubernetes` provider. After this learning, we approach K8S and Celery dependencies a bit differently than any other dependencies. * for Celery and K8S (and Dask but this is rather an afterhought) we do not strip-off the dependencies from the extra (so for example [cncf.kubernetes] extra will have dependencies on both 'apache-airflow-providers-cncf-kubernetes' as well as directly on kubernetes library * We add upper-bound limits for both Celery and Kubernetes to prevent from accidental upgrades. Both Celery and Kubernetes Python library follow SemVer, and they are crucial components of Airlfow so they both squarely fit our "do not upper-bound" exceptions. * We also add a rule that whenever dependency upper-bound limit is raised, we should also make sure that additional testing is done and appropriate `apache-airflow` lower-bound limit is added for the `apache-airflow-providers-cncf-kubernetes` and `apache-airflow-providers-celery` providers. As part of this change we also had to fix two issues: * the image was needlesly rebuilt during constraint generation as we already have the image and we even warn that it should be built before we run constraint generation * after this change, the currently released, unyanked cncf.kubernetes provider cannot be installed with airflow, because it has conflicting requirements for kubernetes library (provider has <11 and airflow has > 22.7). Therefore during constraint generation with PyPI providers we install providers from PyPI, we explicitly install the yanked 3.1.2 version. This should be removed after we release the next K8S provider version. That should protect our users in all scenarios where they might unknowingly attempt to upgrade Kubernetes or Celery to incompatible version. Related to: apache#22560, apache#21727
Kubernetes and Celery are both providers and part of the core. The dependencies for both are added via "extras" which makes them "soft" limits and in case of serious dependency bumps this might end up with a mess (as we experienced with bumping min K8S library version from 11.0.0 to 22.* (resulting in yanking 4 versions of `cncf.kubernetes` provider. After this learning, we approach K8S and Celery dependencies a bit differently than any other dependencies. * for Celery and K8S (and Dask but this is rather an afterhought) we do not strip-off the dependencies from the extra (so for example [cncf.kubernetes] extra will have dependencies on both 'apache-airflow-providers-cncf-kubernetes' as well as directly on kubernetes library * We add upper-bound limits for both Celery and Kubernetes to prevent from accidental upgrades. Both Celery and Kubernetes Python library follow SemVer, and they are crucial components of Airlfow so they both squarely fit our "do not upper-bound" exceptions. * We also add a rule that whenever dependency upper-bound limit is raised, we should also make sure that additional testing is done and appropriate `apache-airflow` lower-bound limit is added for the `apache-airflow-providers-cncf-kubernetes` and `apache-airflow-providers-celery` providers. As part of this change we also had to fix two issues: * the image was needlesly rebuilt during constraint generation as we already have the image and we even warn that it should be built before we run constraint generation * after this change, the currently released, unyanked cncf.kubernetes provider cannot be installed with airflow, because it has conflicting requirements for kubernetes library (provider has <11 and airflow has > 22.7). Therefore during constraint generation with PyPI providers we install providers from PyPI, we explicitly install the yanked 3.1.2 version. This should be removed after we release the next K8S provider version. That should protect our users in all scenarios where they might unknowingly attempt to upgrade Kubernetes or Celery to incompatible version. Related to: #22560, #21727
Apache Airflow version
2.2.4 (latest released)
What happened
When using KubernetesExecutor with
in_cluster = False
in conjunction with a Config with anexec
user usingkubelogin
, something wrong happens and authentication does not take place:I managed to trace back to the source of the error to
RefreshConfiguration
, and create a workaround.airflow/airflow/kubernetes/kube_client.py
Lines 45 to 46 in ee9049c
Bypassing the
RefreshConfiguration
by changing the above two lines to:resolves the problem. I am still debugging what exactly the problem is with
RefreshConfiguration
andkubelogin
.Factoids:
What you think should happen instead
Authentication should work without a problem.
How to reproduce
It's hard to reproduce given the specificity of the problem.
kubelogin
kubelogin
exec authentication flow with service principal authentication with the correct values filled in. See docsOperating System
Debian
Versions of Apache Airflow Providers
No response
Deployment
Docker-Compose
Deployment details
Proof of concept deployment with Docker compose for local development purposes using KubernetesExecutor to schedule worker pods in an AKS cluster.
Anything else
This issue happens every time.
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: