Unable to run Airflow DAGs with KubernetesExecutor - AirflowException: dag_id could not be found

7/17/2020

I am new to Airflow and have been trying for a while now to get a task ran using the KubernetesPodOperator class without any luck. The pod gets created and synchronizes the DAGs from a git repo, I don't see any errors retrieving the DAGs but the pod fails quickly with this error:

[2020-07-16 23:55:16,593] {__init__.py:51} INFO - Using executor LocalExecutor
[2020-07-16 23:55:16,594] {dagbag.py:396} INFO - Filling up the DagBag from /opt/airflow/dags/kubernetes_executor.py
Traceback (most recent call last):
  File "/home/airflow/.local/bin/airflow", line 37, in <module>
    args.func(args)
  File "/home/airflow/.local/lib/python3.6/site-packages/airflow/utils/cli.py", line 75, in wrapper
    return f(*args, **kwargs)
  File "/home/airflow/.local/lib/python3.6/site-packages/airflow/bin/cli.py", line 523, in run
    dag = get_dag(args)
  File "/home/airflow/.local/lib/python3.6/site-packages/airflow/bin/cli.py", line 149, in get_dag
    'parse.'.format(args.dag_id))
airflow.exceptions.AirflowException: dag_id could not be found: kubernetes_sample. Either the dag did not exist or it failed to parse.

I am deploying Airflow 1.10.10 on EKS using Helm. Below is my airflow config file. I noticed this is the same issue as https://stackoverflow.com/questions/62686753/airflow-dag-id-could-not-be-found-issue-when-using-kubernetes-executor and I have tried different combinations for AIRFLOW__KUBERNETES__GIT_DAGS_FOLDER_MOUNT_POINT and AIRFLOW__KUBERNETES__GIT_SYNC_ROOT with no luck.

Any ideas? I am completely stuck.

airflow:
  executor: KubernetesExecutor
  config:
    AIRFLOW__CORE__EXECUTOR: KubernetesExecutor
    AIRFLOW__CORE__LOGGING_LEVEL: INFO
    AIRFLOW__CORE__SQL_ALCHEMY_CONN: "postgresql+psycopg2://postgres:airflow@airflow-postgresql:5432/airflow"
    AIRFLOW__CORE__DAGS_FOLDER: /opt/airflow/dags
    AIRFLOW__KUBERNETES__WORKER_CONTAINER_REPOSITORY: "apache/airflow"
    AIRFLOW__KUBERNETES__WORKER_CONTAINER_TAG: "1.10.10-python3.6"
    AIRFLOW__KUBERNETES__NAMESPACE: airflow
    AIRFLOW__KUBERNETES__WORKER_SERVICE_ACCOUNT_NAME: airflow
    AIRFLOW__KUBERNETES__DELETE_WORKER_PODS: false
    AIRFLOW__KUBERNETES__RUN_AS_USER: 50000
    AIRFLOW__KUBERNETES__FS_GROUP: 65533
    AIRFLOW__KUBERNETES__GIT_REPO: ssh://git@github.com/rootstrap/champz-extractor.git
    AIRFLOW__KUBERNETES__GIT_BRANCH: seba
    AIRFLOW__KUBERNETES__GIT_DAGS_FOLDER_MOUNT_POINT: /opt/airflow/dags
    AIRFLOW__KUBERNETES__GIT_SYNC_DEST: ""
    AIRFLOW__KUBERNETES__GIT_SYNC_ROOT: /opt/airflow/dags  
    AIRFLOW__KUBERNETES__GIT_SSH_KEY_SECRET_NAME: airflow-secrets

workers:
  enabled: false
flower:
  enabled: false
redis:
  enabled: false

dags:
  
  git:
    url: ssh://git@github.com/rootstrap/champz-extractor.git
    repoHost: github.com
    repoPort: 22
    ref: seba
    secret: airflow-git-keys
    privateKeyName: id_rsa

    gitSync:
      enabled: true
      refreshTime: 60
  
  initContainer:
    enabled: true
      
  installRequirements: true


ingress:
  enabled: true
-- Sebasti&#225;n Lopez
airflow
kubernetes
kubernetesexecutor

0 Answers