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
Allow passing config_path as a parameter to KubernetesExecutor #46293
Currently, when using executor_config with KubernetesExecutor, the config_file path must be hardcoded. If we try to pass it dynamically using a Jinja template ("{{ params.config_path }}"), it results in an error.
This would be useful when deploying DAGs across different environments (e.g., multiple regions) without hardcoding paths.
Proposed Solution:
Modify executor_config to allow templating in KubernetesExecutor.config_file, similar to other templated parameters in Airflow.
Use case/motivation
This would be useful when deploying DAGs across different environments (e.g., multiple regions) without hardcoding paths.
Airflow should allow config_file to accept templated values, resolving them at runtime.
This feature would improve flexibility when running KubernetesExecutor tasks that need different configurations based on dynamic parameters.
Would love to hear thoughts from the community on this! Thanks! 😊
Related issues
This feature would improve Airflow’s flexibility in hybrid execution environments and align with the goals of AIP-61. Would love to hear thoughts from the community on this! 🚀
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.
If you can take a look at propose a PR solving it, yes I think it would be useful. But it needs a deep look in the code whether it's possible, also with Airflow 3 changes / Task SDK changes in progress, likely doing it after this is completed, is a good idea.
I've dug through the code and also experimented a bit, and couldn't find any way to rewrite the initial config file for KubernetesExecutor. Am I missing something? Any of the executor_config I've tried to use with deprecated KubernetesExecutor variant except the empty one led to the error:
{kubernetes_executor.py:355} ERROR - Invalid executor_config for TaskInstanceKey
Currently, when using executor_config with KubernetesExecutor, the config_file path must be hardcoded. If we try to pass it dynamically using a Jinja template ("{{ params.config_path }}"), it results in an error.
Example of a working static configuration:
executor_config={"KubernetesExecutor": {"config_file": "/opt/airflow/config/kubernetes/docker-desktop-config.yaml"}}
However, if we attempt to pass it dynamically, it fails:
executor_config={"KubernetesExecutor": {"config_file": "{{ params.config_path }}"}}
This would be useful when deploying DAGs across different environments (e.g., multiple regions) without hardcoding paths.
Proposed Solution:
Modify executor_config to allow templating in KubernetesExecutor.config_file, similar to other templated parameters in Airflow.
Use case/motivation
This would be useful when deploying DAGs across different environments (e.g., multiple regions) without hardcoding paths. Airflow should allow config_file to accept templated values, resolving them at runtime. This feature would improve flexibility when running KubernetesExecutor tasks that need different configurations based on dynamic parameters. Would love to hear thoughts from the community on this! Thanks! 😊
Related issues
This feature would improve Airflow’s flexibility in hybrid execution environments and align with the goals of AIP-61. Would love to hear thoughts from the community on this! 🚀
Hello, could anyone clarify further on what needs to be done?
How will an end result dag look like?
I'm looking into it and this setting is possible on task and dag level, which one should be implemented? Isn't it better to implement it for the task instead?
This is not meant to discourage your contribution — quite the opposite! You are still very welcome to work on this issue and submit a PR for it. Simply comment that you are working on it and open a PR when ready.
We found that formal assignments were not working well, as they often prevented others from contributing when the assignee was not actively working on the issue.
Activity
boring-cyborg commentedon Jan 30, 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.
potiuk commentedon Jan 31, 2025
If you can take a look at propose a PR solving it, yes I think it would be useful. But it needs a deep look in the code whether it's possible, also with Airflow 3 changes / Task SDK changes in progress, likely doing it after this is completed, is a good idea.
insomnes commentedon Feb 1, 2025
Are you sure you can rewrite it with?
I've dug through the code and also experimented a bit, and couldn't find any way to rewrite the initial config file for
KubernetesExecutor. Am I missing something? Any of theexecutor_configI've tried to use with deprecatedKubernetesExecutorvariant except the empty one led to the error:Maryam3107 commentedon Feb 2, 2025
I can solve this problem. kindly assign it to me
Nataneljpwd commentedon Jul 2, 2025
Hello, could anyone clarify further on what needs to be done?
How will an end result dag look like?
I'm looking into it and this setting is possible on task and dag level, which one should be implemented? Isn't it better to implement it for the task instead?
potiuk commentedon Mar 2, 2026
@Maryam3107 We are unassigning you from this issue as part of our updated assignment policy.
This is not meant to discourage your contribution — quite the opposite! You are still very welcome to work on this issue and submit a PR for it. Simply comment that you are working on it and open a PR when ready.
We found that formal assignments were not working well, as they often prevented others from contributing when the assignee was not actively working on the issue.
kunaljubce commentedon Jun 6, 2026
I started looking into this but given the changes introduced in #10756 and thereafter, any support for
KubernetesExecutorinsideexecutor_configseems to be deprecated now, raising aTypeErrorinstead - https://github.com/astronomer/airflow/blob/main/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/pod_generator.py#L202-L206Will wait for @jedcunningham/any other Airflow PMC for their expertise on K8sOperator to comment on this!