稳定 / Airflow 连接外部 PostgreSQL 数据库

3
我正在使用 https://github.com/helm/charts/tree/master/stable/airflow 将 Airflow 部署到 Kubernetes 中。
我尝试通过修改 values.yml 来连接外部的 PostgreSQL 数据库:
externalDatabase:
  ## the type of external database: {mysql,postgres}
  ##
  type: postgres

  ## the host of the external database
  ##
  host: <HOST>

  ## the port of the external database
  ##
  port: 5432

  ## the database/scheme to use within the the external database
  ##
  database: airflow

  ## the user of the external database
  ##
  user: <USER>

  ## the name of a pre-created secret containing the external database password
  ##
  passwordSecret: ""

  ## the key within `externalDatabase.passwordSecret` containing the password string
  ##
  passwordSecretKey: ""

  ## the connection properties for external database, e.g. "?sslmode=require"
  properties: "?sslmode=require"

但是它正在请求 passwordSecretpasswordSecretKey

我如何在Kubernetes中创建 passwordSecret 密钥?

passwordSecretKey 是airflow用户的密码吗?


passwordSecretKey是airflow用户的密码?我应该为它设置什么值? - Namballa Mukesh
2个回答

4

最简单的方法是按照这里的步骤操作。

创建一个名为mysecretcreator.yaml的yaml文件。

apiVersion: v1
kind: Secret
metadata:
  name: mysecret
type: Opaque
data:
  username: YWRtaW4=
  password: MWYyZDFlMmU2N2Rm

然后运行kubectl apply -f mysecretcreator.yaml

秘钥创建完成后,将以下内容添加到custom-values.yaml文件中

  ## the name of a pre-created secret containing the external database password
  ##
  passwordSecret: "mysecret"

密码密钥应该填什么? - Namballa Mukesh

0

既然您已将用户名定义为字符串,那么您可以将密码放在secrets.yaml文件的data/StringData字段中。使用字符串数据link

apiVersion: v1
kind: Secret
metadata:
  name: airflow-postgres-key
  namespace: airflow
type: Opaque
stringData:
  passwd: mypas_sword=

你可以在 values.yaml 文件中引用这些。
## the user of the external database
  ##
  user: <USER_Name>

  ## the name of a pre-created secret containing the external database password
  ##
  passwordSecret: airflow-postgres-key

  ## the key within `externalDatabase.passwordSecret` containing the password string
  ##
  passwordSecretKey: passwd

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接