Hi all,
What is the recommended way to initiate kube_client from the scheduler, specifically for the purposes of extracting values of k8s Secrets? I am programmatically generating tasks and would like to pass in values of associated k8s Secrets to each task.
The following code works as part of a PythonOperator callable, but not outside of the scope of the operator:
from airflow.contrib.kubernetes import kube_client
client = kube_client.get_kube_client(
    in_cluster=False,
    cluster_context=None,
    config_file='/home/airflow/composer_kube_config',
)
secrets = client.list_secret_for_all_namespaces()
The error I'm receiving is: Broken DAG: [/home/airflow/gcs/dags/test_amir.py] [Errno 2] No such file or directory: '/home/airflow/composer_kube_config'.
I dropped a shell onto Airflow scheduler and worker pods, and found out that /home/airflow/composer_kube_config file only exists on the workers (not the scheduler). 
Is it safe to re-create the same file on the scheduler?
I am using composer-1.4.2-airflow-1.10.0.
Any advice is much appreciated.
Thank you,
Amir Amangeldi
EVERQUOTE  |  Software Engineer