Retrieve Kubernetes' Secret from Google Composer (Airflow)

10/5/2018

I have an Apache Airflow working on Kubernetes (via Google Composer). I want to retrieve one variable store in Secret:

enter image description here

I need to consume the variables stored in this Secret from a DAG in Airflow.(python).

-- Viento
airflow
google-cloud-platform
kubernetes
python

1 Answer

10/5/2018

The variables are stored as "Environment Vars", so in Python is quite easy:

import os
os.environ['DB_USER'])
-- Viento
Source: StackOverflow