1

I am trying to pass environment variables to my container using env_vars parameters of the KubernetesPodOperator.

        task_fetch = KubernetesPodOperator(
        task_id=FETCH,
        name=FETCH,
        image=K8S_PRODUCTION_IMAGE,
        in_cluster=K8S_IN_CLUSTER,
        namespace=K8S_NAMESPACE,
        get_logs=True,
        do_xcom_push=False,
        config_file="/app/.kube/config",
        affinity=K8S_AFFINITY,
        cmds=["echo $POSTGRES_URL"],
        env_vars={"POSTGRES_URL": "dummy"},
    )

I would expect the operator to print out dummy but it's not what's happening.

Is there any specific way of accessing that kind of env variables at runtime inside the container?

Elie Ladias
  • 111
  • 2
  • 16

0 Answers0