<p>I'm working in a setup where I have a docker container running airflow deployed on Kubernetes. What I'm trying to do is package the dags definition file with the docker container that contains the airflow installation (for versioning purposes), and then have the ConfigMap which defines the dags_folder directory specify the directory (within airflow-docker) where that dags definition file is.</p>

<p>Dockerfile (airflow is the k8s namespace)</p>

<pre><code>RUN mkdir /home/airflow/ \
    &amp;&amp; mkdir /home/airflow/dags \
    &amp;&amp; chown airflow:airflow /home/airflow \
    &amp;&amp; chown airflow:airflow /home/airflow/dags

...

ADD dags.py /home/airflow/dags
USER airflow
</code></pre>

<hr>

<p>ConfigMap</p>

<pre><code>  airflow.cfg: |
    [core]
    dags_folder = /home/airflow/dags
</code></pre>

Arjun Guha
<p>You have to create config file</p>

<pre><code>airflow.cfg: |
data:
  core: 
    dags_folder = /home/airflow/dags
</code></pre>

<p>Then mount it in deployment.yml file. </p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: your_app_name
  namespace: default or your namespace
spec:
  replicas: 1
  selector:
    matchLabels:
      app: your_app_name
  template:
    metadata:
      labels:
        app: your_app_name
    spec:
      container:
        - name: Your image.
          ports:
           - name: my_app_port
             containerPort: 7000
          volumeMounts:
            - mountPath: /your/directory/airflow.cfg
              subPath: core
              name: name of config_map # this should match with name of config map
      volumes:
        - name: name of the config_map 
          configMap:
            name: your_config_map

</code></pre>
