I am currently trying to setup Airflow to work in a Kubernetes like environment. For airflow to be useful, I need to be able to use the Git-Sync features so that the DAGs can be stored seperatly from the Pod, thus not being reset when the Pod downscales or restarts. I am trying to set it up with ssh.
I have been searching for good documentation on the Airflow config or tutorials on how to set this up properly, but this has been to no avail. I would very much appreciate some help here, as I have been struggling with this for a while.
Here is how i set the relevant config, please note I have some stand ins for links and some information due to security reasons:
git_repo = https://<git-host>/scm/<project-name>/airflow
git_branch = develop
git_subpath = dags
git_sync_root = /usr/local/airflow
git_sync_dest = dags
git_sync_depth = 1
git_sync_ssh = true
git_dags_folder_mount_point = /usr/local/airflow/dags
git_ssh_key_secret_name = airflow-secrets
git_ssh_known_hosts_configmap_name = airflow-configmap
dags_folder = /usr/local/airflow/
executor = KubernetesExecutor
dags_in_image = False
Here is how I have setup my origin/config repo:
-root
|-configmaps/airflow
|-airflow.cfg
|-airflow-configmap.yaml
|-environment
|-<environment specific stuff>
|-secrets
|-airflow-secrets.yaml
|-ssh
|-id_rsa
|-id_rsa.pub
|-README.md
The airflow-conifgmap and secrets look like this:
apiVersion: v1
kind: Secret
metadata:
name: airflow-secrets
data:
# key needs to be gitSshKey
gitSshKey: <base64 encoded private sshKey>
and
apiVersion: v1
kind: ConfigMap
metadata:
name: airflow-configmap
data:
known_hosts: |
https://<git-host>/ ssh-rsa <base64 encoded public sshKey>
The repo that I am trying to sync to has the Public key set as an access key and is just a folder named dags with 1 dag inside.
My issue is that I do not know what my issue is at this point. I have no way of knowing what part of my config has been set correctly and what part of it is set incorrectly and documentation on the subject is very lackluster.
If there is more information that is required I will be happy to provide it.
Thank you for your time