https://prefect.io logo
#prefect-community
Title
# prefect-community
a

Amit

07/30/2020, 4:26 PM
Hi Is there a way to access Prefect Agent's environment (K8s agent) variable in the flow Job Pod?
👀 1
d

Dylan

07/30/2020, 4:44 PM
Hi @Amit, You can configure the agent to set environment variables on the flow job pods. The documentation is a little out of date, so I’ll open an issue
But if you use:
Copy code
prefect agent install kubernetes --help
You should see:
Copy code
(prefect_cloud) dylanhughes@Dylans-MacBook-Pro-Prefect ~/d/cloud> prefect agent install kubernetes --help                                                                                               dev
Usage: prefect agent install [OPTIONS] NAME

  Install an agent. Outputs configuration text which can be used to install
  on various platforms. The Prefect image version will default to your local
  `prefect.__version__`

  Arguments:
      name                        TEXT    The name of an agent to install (e.g. `kubernetes`, `local`)

  Options:
      --token, -t                 TEXT    A Prefect Cloud API token
      --label, -l                 TEXT    Labels the agent will use to query for flow runs
                                          Multiple values supported e.g. `-l label1 -l label2`
      --env, -e                   TEXT    Environment variables to set on each submitted flow run.
                                          Note that equal signs in environment variable values are not currently supported from the CLI.
                                          Multiple values supported e.g. `-e AUTH=token -e PKG_SETTING=true`
If you use that
--env
flag I believe that should work for you
Let me know if I can help further!
a

Amit

07/30/2020, 4:47 PM
Hi @Dylan thanks for help, that's very useful.
d

Dylan

07/30/2020, 4:48 PM
Anytime!
🙌 1