stable/airflow connect external PostgreSQL database

10/11/2020

I am deploying airflow into Kubernetes using: https://github.com/helm/charts/tree/master/stable/airflow

I am trying to connect my external PostgreSQL database by modifying the values.yml:

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"

But it is requesting passwordSecretand passwordSecretKey.

How I can create passwordSecret secret in Kubernetes?

passwordSecretKey is the password for the airflow user?

-- J.C Guzman
airflow
kubernetes
kubernetes-helm

1 Answer

10/11/2020

The easiest way is to follow the steps here.

Create a yaml file called mysecretcreator.yaml

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

And then run kubectl apply -f mysecretcreator.yaml

Once the secret has been created, add the following to the custom-values.yaml

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