简体   繁体   中英

How can I get configfile to access minikube from outside cluster to create pods, delete pods, etc

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? 0 comments

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM