Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Airflow When to use KubernetesExecutor vs KubernetesPodOperator?

Does the Executor automatically send tasks to pods, or do I need the operator to do that?

Each operator has the "executor_config" param so I'm not sure when to use either.

like image 794
AlanPear Avatar asked Dec 17 '22 14:12

AlanPear


1 Answers

They serve different purposes.

Briefly:

KubernetesExecutor: You need to specify one of the supported executors when you set up Airflow. The executor controls how all tasks get run. In the case of the KubernetesExecutor, Airflow creates a pod in a kubernetes cluster within which the task gets run, and deletes the pod when the task is finished.

Basically, you would use this instead of something like Celery.

KubernetesPodOperator: This allows you to, essentially, run a container as a task, and that container will be run inside a pod on a kubernetes cluster.

You'd use this if you if you have containerized workloads that you need to schedule in Airflow, or if you have non-python code you want to execute as Airflow tasks.

Hope that is helpful.

like image 71
brandondtb Avatar answered Jan 04 '23 00:01

brandondtb