我目前正在 Google Cloud GCP 中的 Kubernetes 上运行 Airflow。我的项目基于docker-airflow。我可以启动 UI,但是当我尝试为 google cloud 创建连接并提交连接时,出现以下错误。
ValueError: Fernet key must be 32 url-safe base64-encoded bytes.
Run Code Online (Sandbox Code Playgroud)[2018-09-21 19:45:13,345] AirflowException: Could not create Fernet object: Fernet key must be 32 url-safe base64-encoded bytes.
Run Code Online (Sandbox Code Playgroud)文档建议的第一个问题是确保您安装了加密技术,我就是这样做的。我安装了两种类型,一种是带有气流的,另一种是来自 PyPi 的标准类型。
pip3 install apache-airflow[kubernetes,crypto] and also tried
pip install cryptography
Run Code Online (Sandbox Code Playgroud)
我尝试运行用于生成和存储环境变量的命令,如文档中所述,可在此处找到。(如下所示)
1)手动生成 fernet 密钥并添加到 airflow.cfg
2)设置环境变量并重新启动服务器。
python -c "from cryptography.fernet import Fernet;
print(Fernet.generate_key().decode())"
Run Code Online (Sandbox Code Playgroud)
示例键:81HqDtbqAywKSOumSha3BhWNOdQ26slT6K0YaZeZyPs=
使用 kubernetes,我无法使用关闭进程 ID 的典型方法来重新启动服务器,因为它与容器绑定。我还尝试将生成的密钥(上图)放入 kubernetes 集群的 configmaps.yaml 文件中(部署时等于airflow.cfg)。
我尝试通过 DAG、UI …