在Kubernetes上运行Airflow任务

时间:2019-08-01 22:22:33

标签: kubernetes airflow

我对在Kubernetes上运行特定的Airflow任务感兴趣。气流工人本身无需在Kubernetes上运行。做一些研究时,我遇到了KubernetesPodOperator。但是,我没有找到有关如何配置操作员以在群集中运行的示例。是否可以配置KubernetesPodOperator在远程集群上运行任务?该行为应类似于ECSOperator。

1 个答案:

答案 0 :(得分:0)

气流可以在kubernetes内部和外部运行。

在您的情况下,当您在kubernetes集群之外运行气流时,您需要告诉airflow在哪里可以找到kubernetes集群。

KubernetesPodOperator source code

client = kube_client.get_kube_client(in_cluster=self.in_cluster,
                                                 cluster_context=self.cluster_context,
                                                 config_file=self.config_file)

启动KubernetesPodOperator时需要设置这3个参数

关于这些参数的详细说明也位于源代码中

:param in_cluster: run kubernetes client with in_cluster configuration.
:param cluster_context: context that points to kubernetes cluster. Ignored when in_cluster is True. If None, current-context is used.
:param config_file: The path to the Kubernetes config file. (templated) If not specified, default value is ``~/.kube/config``