Hi Team,

I have a requirement where my Airflow is running on k8 cluster and i am
using Kubernetes pod operator in my dag to create the pod in different
cluster but it is creating the pod in the same cluster where my Airflow is
running which is because of default setting from airflow in this path :

/home/airflow/.local/lib/python3.8/site-packages/airflow/kubernetes/
kube_client.py


The setting here is below:


-----

def _get_kube_config(in_cluster,  # type: bool

                         cluster_context,  # type: Optional[str]

                         config_file,  # type: Optional[str]

                         ):  # type: (...) -> Optional[Configuration]

        if in_cluster:

            # load_incluster_config set default configuration with config
populated by k8s

            config.load_incluster_config()

            cfg = None

        else:

            # this block can be replaced with just config.load_kube_config
once

            # refresh_config module is replaced with upstream fix

            cfg = RefreshConfiguration()

            load_kube_config(

                client_configuration=cfg, config_file=config_file,
context=cluster_context)


        if PY2:

            # For connect_get_namespaced_pod_exec

            configuration = Configuration()

            configuration.assert_hostname = False

            Configuration.set_default(configuration)

        return cfg


------


Kindly help me in changing this setting.


Thanks,

Rahul Jain

Reply via email to