AirFlow KubernetesHook sometimes work and sometimes not

2/16/2022

We have airflow installed within k8s cluster. It is running in different pods: psql, scheduler, statsd and webserver. Some of its tasks is to activate other k8s jobs. I see in the code that we're using KubernetesHook with kubernetes_conn_id: str = "kubernetes_default".

We have two k8s cluster (not installed by us and probably with different restrictions). On one k8s the DAG we have is able to activate the job "as is" - I'm guessing it receives the k8s credentials somehow. (this: https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/stable/connections/kubernetes.html does not explain much).

On the other k8s the job is not activated, only after we copy the .kube/config into the pod to the HOME of airflow: /home/airflow

So I'm guessing that in the second k8s, something is blocking from having the credentials.

What should I check? which configuration is blocking the credentials from reaching the airflow?

AIRFLOW_VERSION=2.1.2

K8s Rev: v1.21.9

Thanks

-- Doron Veeder
airflow
kubeconfig
kubernetes

0 Answers