[英]How can I install Kubernetes operator and executer on docker based airflow
I'm using Puckels docker file to build and run dags.我正在使用 Puckels docker 文件来构建和运行 dags。 I'm trying to create new dags that I can execute on a Kube.netes pod but I'm not sure how to get it working on the docker's airflow container.我正在尝试创建可以在 Kube.netes pod 上执行的新 dag,但我不确定如何让它在 docker 的 airflow 容器上运行。 I tried adding to the docker file我尝试添加到 docker 文件
pip install 'apache-airflow[kubernetes]'
then I tried adding the following line into my dag:然后我尝试将以下行添加到我的 dag 中:
from airflow.contrib.operators import KubernetesOperator
This is the error message I get:这是我收到的错误消息:
cannot import name 'KubernetesOperator' from 'airflow.contrib.operators' (unknown location)
The Kube.netesPodOperator
is defined under the kube.netes_pod_operator
. Kube.netesPodOperator
在kube.netes_pod_operator
下定义。 You should be using:你应该使用:
from airflow.contrib.operators.kubernetes_pod_operator import KubernetesPodOperator
Please also check out this Airflow documentation page .另请查看此 Airflow 文档页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.