我正在在Kubernetes上使用Airflow,选择了git-sync选项来部署DAGS。当我们的git repo推送新的DAGS时,airflow直到我们重新启动调度器pod才会更新新的DAGS。有没有其他方法可以更新DAGS而无需重新启动调度器pod?
我正在在Kubernetes上使用Airflow,选择了git-sync选项来部署DAGS。当我们的git repo推送新的DAGS时,airflow直到我们重新启动调度器pod才会更新新的DAGS。有没有其他方法可以更新DAGS而无需重新启动调度器pod?
通过使用 git-sync sidecar 容器解决了这个问题。
在 values.yaml 文件中有一个 extraContainers:
选项。我们可以将 Kubernetes git-sync 添加为 sidecar 容器,以持续从 Git 同步。
extraContainers:
## Additional containers to run alongside the Scheduler, Worker and Web pods
## This could, for example, be used to run a sidecar that syncs DAGs from object storage.
- name: git-sync
image: k8s.gcr.io/git-sync:v3.1.1
volumeMounts:
- name: ssh-key
mountPath: /var/ssh
- name: known-hosts
mountPath: /var/knownhosts
- name: git-sync-volume
mountPath: /tmp/git
env:
- name: GIT_SYNC_REPO
value: git@gitlab.example.com/test.git
- name: GIT_SYNC_DEST
value: git
- name: GIT_SYNC_WAIT
value: "10"
- name: GIT_SYNC_SSH
value: "true"
- name: GIT_SSH_KEY_FILE
value: /var/ssh/sshkey
- name: GIT_SSH_KNOWN_HOSTS_FILE
value: /var/knownhosts/known_hosts
## Additional volumeMounts to the main containers in the Scheduler, Worker and Web pods.
extraVolumeMounts:
# - volumeMounts:
- mountPath: "/var/ssh"
name: ssh-key
readOnly: true
- mountPath: "/var/knownhosts"
name: known-hosts
readOnly: true
- name: git-sync-volume
mountPath: /tmp/git
extraVolumes:
#- volumes:
- name: ssh-key
secret:
secretName: dags-secret
items:
- key: key
path: sshkey
- name: known-hosts
secret:
secretName: dags-secret
items:
- key: known_hosts
path: known_hosts
- name: git-sync-volume
emptyDir: {}