<p>I'm setting up an Airflow environment on Google Cloud Composer for testing. I've added some secrets to my namespace, and they show up fine:</p>

<pre><code>$ kubectl describe secrets/eric-env-vars
Name:         eric-env-vars
Namespace:    eric-dev
Labels:       &lt;none&gt;
Annotations:  &lt;none&gt;

Type:  Opaque

Data
====
VERSION_NUMBER:  6 bytes
</code></pre>

<p>I've referenced this secret in my DAG definition file (leaving out some code for brevity):</p>

<pre><code>env_var_secret = Secret(
    deploy_type='env',
    deploy_target='VERSION_NUMBER',
    secret='eric-env-vars',
    key='VERSION_NUMBER',
)

dag = DAG('env_test', schedule_interval=None, start_date=start_date)

operator = KubernetesPodOperator(
    name='k8s-env-var-test',
    task_id='k8s-env-var-test',
    dag=dag,
    image='ubuntu:16.04',
    cmds=['bash', '-cx'],
    arguments=['env'],
    config_file=os.environ['KUBECONFIG'],
    namespace='eric-dev',
    secrets=[env_var_secret],
)
</code></pre>

<p>But when I run this DAG, the <code>VERSION_NUMBER</code> env var isn't printed out. It doesn't look like it's being properly linked to the pod either (apologies for imprecise language, I am new to both Kubernetes and Airflow). This is from the Airflow task log of the pod creation response (also formatted for brevity/readability):</p>

<pre><code>'env': [
{
    'name': 'VERSION_NUMBER',
    'value': None,
    'value_from': {
        'config_map_key_ref': None,
        'field_ref': None,
        'resource_field_ref': None,
        'secret_key_ref': {
            'key': 'VERSION_NUMBER',
            'name': 'eric-env-vars',
            'optional': None}
        }
    }
]
</code></pre>

<p>I'm assuming that we're somehow calling the constructor for the <code>Secret</code> wrong, but I am not entirely sure. Guidance appreciated!</p>

Eric Fulmer
<p>Turns out this was a misunderstanding of the logs!</p>

<p>When providing an environment variable to a Kubernetes pod via a Secret, that <code>value</code> key in the API response is <code>None</code> because the value comes from the <code>secret_key_ref</code>. </p>
