简体   繁体   中英

How can I install Kubernetes operator and executer on docker based airflow

I'm using Puckels docker file to build and run 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. I tried adding to the docker file

pip install 'apache-airflow[kubernetes]'

then I tried adding the following line into my 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 . You should be using:

from airflow.contrib.operators.kubernetes_pod_operator import KubernetesPodOperator

Please also check out this Airflow documentation page .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM