我是Airflow和Kubernetes的新手。我正在尝试在Kubernetes中使用Apache Airflow。
要部署它,我使用了以下图表:https://github.com/apache/airflow/tree/master/chart。
我想将我的dags上传到我的github仓库中,以便:
gitSync:
enabled: true
# git repo clone url
# ssh examples ssh://git@github.com/apache/airflow.git
# git@github.com:apache/airflow.git
# https example: https://github.com/apache/airflow.git
repo: https://github.com/mygithubrepository.git
branch: master
rev: HEAD
root: "/git"
dest: "repo"
depth: 1
# the number of consecutive failures allowed before aborting
maxFailures: 0
# subpath within the repo where dags are located
# should be "" if dags are at repo root
subPath: ""
然后我看到要使用私有github存储库,我必须创建value.yml文件中指定的秘密:
# if your repo needs a user name password
# you can load them to a k8s secret like the one below
# ---
# apiVersion: v1
# kind: Secret
# metadata:
# name: git-credentials
# data:
# GIT_SYNC_USERNAME: <base64_encoded_git_username>
# GIT_SYNC_PASSWORD: <base64_encoded_git_password>
# and specify the name of the secret below
#credentialsSecret: git-credentials
我正在创建秘密:
apiVersion: v1
data:
GIT_SYNC_USERNAME: bXluYW1l
GIT_SYNC_PASSWORD: bXl0b2tlbg==
kind: Secret
metadata:
name: git-credentials
namespace: default
然后我在value.yml文件中使用秘密名称:
repo: https://github.com/mygithubrepository.git
branch: master
rev: HEAD
root: "/git"
dest: "repo"
depth: 1
# the number of consecutive failures allowed before aborting
maxFailures: 0
# subpath within the repo where dags are located
# should be "" if dags are at repo root
subPath: ""
# if your repo needs a user name password
# you can load them to a k8s secret like the one below
# ---
# apiVersion: v1
# kind: Secret
# metadata:
# name: git-credentials
# data:
# GIT_SYNC_USERNAME: <base64_encoded_git_username>
# GIT_SYNC_PASSWORD: <base64_encoded_git_password>
# and specify the name of the secret below
credentialsSecret: git-credentials
但似乎蜜蜂没有工作。
答案 0 :(得分:2)
我看到您正在通过https
连接到github存储库。
尝试使用:
ssh://git@github.com/mygithubrepository.git
或者简单地
git@github.com/mygithubrepository.git
通过https
进行连接时会遇到问题,尤其是在github帐户上启用了双重身份验证的情况下。 this文章中对此进行了更详细的描述。
如Oliver所述 answer,一个HTTPS网址 如果two-factor authentication (2FA)不会使用用户名/密码 被激活。
在这种情况下,密码应为PAT (personal access token),如“ Using a token on the command line”所示。
仅适用于HTTPS URLS,SSH不受此影响 限制。
但是正如我所说,仅使用ssh
而不是https
可以轻松解决您的问题。