kubernetesairflowkubernetesexecutor

Does Airflow Kubernetes Executor run any operator?


I am assessing the migration of my current Airflow deployment from Celery executor to Kubernetes (K8s) executor to leverage the dynamic allocation of resources and the isolation of tasks provided by pods.

It is clear to me that we can use the native KubernetesPodOperator to run tasks on a K8s cluster via the K8s executor. However I couldn't find info about the compatibility between the K8s executor with other operators, such as bash and athena.

Here is the question is it possible to run a bash (or any other) operator on a K8s powered Airflow or I should migrate all my tasks to the KubernetesPodOperator?

Thanks!


Solution

  • Kubernetes executor will work with all operators.
    Using the kubernetes executor will create a worker pod for every task instead of using the celery worker as the celery executor will.

    Using the KubernetesPodOperator will pull any specific image to launch a pod and execute your task.
    So if you are to use the KubernetesPodOperator with the KubernetesExecutor, Airflow will launch a worker pod for your task, and that task will launch a pod and monitor its execution. 2 pods for 1 task.

    If you use a BashOperator with the KubernetesExecutor, Airflow will launch a worker pod and execute bash commands on that worker pod. 1 pod for 1 task.