<p>I am using airflow stable helm chart and using Kubernetes Executor, new pod is being scheduled for dag but its failing with dag_id could not be found issue. I am using git-sync to get dags. Below is the error and kubernetes config values. Can someone please help me resolve this issue?</p>
<p>Error:</p>
<pre><code>[2020-07-01 23:18:36,939] {__init__.py:51} INFO - Using executor LocalExecutor
[2020-07-01 23:18:36,940] {dagbag.py:396} INFO - Filling up the DagBag from /opt/airflow/dags/dags/etl/sampledag_dag.py
Traceback (most recent call last):
  File &quot;/home/airflow/.local/bin/airflow&quot;, line 37, in &lt;module&gt;
    args.func(args)
  File &quot;/home/airflow/.local/lib/python3.6/site-packages/airflow/utils/cli.py&quot;, line 75, in wrapper
    return f(*args, **kwargs)
  File &quot;/home/airflow/.local/lib/python3.6/site-packages/airflow/bin/cli.py&quot;, line 523, in run
    dag = get_dag(args)
  File &quot;/home/airflow/.local/lib/python3.6/site-packages/airflow/bin/cli.py&quot;, line 149, in get_dag
    'parse.'.format(args.dag_id))
airflow.exceptions.AirflowException: dag_id could not be found: sampledag  . Either the dag did not exist or it failed to parse.
</code></pre>
<p>Config:</p>
<pre><code>      AIRFLOW__KUBERNETES__DELETE_WORKER_PODS: false
      AIRFLOW__KUBERNETES__GIT_REPO: git@git.com/dags.git
      AIRFLOW__KUBERNETES__GIT_BRANCH: master
      AIRFLOW__KUBERNETES__GIT_DAGS_FOLDER_MOUNT_POINT: /dags
      AIRFLOW__KUBERNETES__GIT_SSH_KEY_SECRET_NAME: git-secret
      AIRFLOW__KUBERNETES__WORKER_CONTAINER_REPOSITORY: airflow-repo
      AIRFLOW__KUBERNETES__WORKER_CONTAINER_TAG: tag
      AIRFLOW__KUBERNETES__RUN_AS_USER: &quot;50000&quot;
</code></pre>
<p>sampledag</p>
<pre><code>import logging
import datetime

from airflow import models
from airflow.contrib.operators import kubernetes_pod_operator
import os

args = {
    'owner': 'airflow'
}

YESTERDAY = datetime.datetime.now() - datetime.timedelta(days=1)


try:
    print(&quot;Entered try block&quot;)
    with models.DAG(
            dag_id='sampledag',
            schedule_interval=datetime.timedelta(days=1),
            start_date=YESTERDAY) as dag:
     
        print(&quot;Initialized dag&quot;)
               kubernetes_min_pod = kubernetes_pod_operator.KubernetesPodOperator(
                # The ID specified for the task.
                task_id='trigger-task',
                # Name of task you want to run, used to generate Pod ID.
                name='trigger-name',
                namespace='scheduler',
                in_cluster = True,
     
                cmds=[&quot;./docker-run.sh&quot;],
                is_delete_operator_pod=False,
                image='imagerepo:latest',
                image_pull_policy='Always',
                dag=dag)

        print(&quot;done&quot;)

except Exception as e:
    print(str(e))
    logging.error(&quot;Error at {}, error={}&quot;.format(__file__, str(e)))
    raise

</code></pre>

user2416
<p>I had the same issue. I solved it by adding the following to my config:</p>
<pre><code>AIRFLOW__KUBERNETES__DAGS_VOLUME_SUBPATH: repo/
</code></pre>
<p>What was happening is that the init container will download your dags in <code>[AIRFLOW__KUBERNETES__GIT_DAGS_FOLDER_MOUNT_POINT]/[AIRFLOW__KUBERNETES__GIT_SYNC_DEST]</code> and <code>AIRFLOW__KUBERNETES__GIT_SYNC_DEST</code> by default is <code>repo</code>  (<a href="https://airflow.apache.org/docs/stable/configurations-ref.html#git-sync-dest" rel="nofollow noreferrer">https://airflow.apache.org/docs/stable/configurations-ref.html#git-sync-dest</a>)</p>
