Reputation: 357
I am trying to setup Airflow to use an external k8s cluster, in local it is minikube, as executor. To do that I need to point Airflow to a kubernetes configfile that contains the necessary information to alow external resources to request and schedule resources on the cluster, but for minikube I am not able to get, generate or know how to write that file, can anyone point me to some help?
Upvotes: 0
Views: 1518
Reputation: 5096
If you are running Airflow inside a K8S cluster (minikube or remote cluster), you don't need a configfile
to access K8S API. You can configure the kubernetes connection to use the in_cluster option:
AIRFLOW_CONN_KUBERNETES_DEFAULT=kubernetes://?extra__kubernetes__in_cluster=True&conn_id=kubernetes_default
If your are running Airflow in docker or directly in you host, and you want to access minikube to test KubernetesPodOperator
, you can provide the config file by setting the config AIRFLOW__KUBERNETES__CONFIG_FILE
.
For the minikube config file, it's auto generated in ~/.kube/config
but merged with the other config files, you can copy it to a new files, and remove the info of the other cluster and contexts (if you have other cluster). If you don't find the minikube config, or you just want to regenerate a new one:
export KUBECONFIG=<path where you want to create it>
minikube start
Once minikube is up, you can find the config file in the folder you provided.
Upvotes: 1