<p>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?</p>

rafaelleru
<p>If you are running Airflow inside a K8S cluster (minikube or remote cluster), you don't need a <code>configfile</code> to access K8S API. You can configure the kubernetes connection to use the in_cluster option:</p>
<pre class="lang-py prettyprint-override"><code>AIRFLOW_CONN_KUBERNETES_DEFAULT=kubernetes://?extra__kubernetes__in_cluster=True&amp;conn_id=kubernetes_default
</code></pre>
<p>If your are running Airflow in docker or directly in you host, and you want to access minikube to test <code>KubernetesPodOperator</code>, you can provide the config file by setting the config <code>AIRFLOW__KUBERNETES__CONFIG_FILE</code>.<br />
For the minikube config file, it's auto generated in <code>~/.kube/config</code> 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:</p>
<pre class="lang-bash prettyprint-override"><code>export KUBECONFIG=&lt;path where you want to create it&gt;
minikube start
</code></pre>
<p>Once minikube is up, you can find the config file in the folder you provided.</p>
