Hi there! Is there an environment variable that ca...
# prefect-community
Hi there! Is there an environment variable that can be set on Kubernetes Agents in order to populate environment variables for flow runs managed by that agent? I see in the docs that you can run:
Copy code
prefect agent <AGENT TYPE> start --env KEY=VALUE --env KEY2=VALUE2
Instead, is it possible to do this by setting an environment variable on the agent, similar to how labels are set?
Copy code
  value: "[]"
Hey @Billy McMonagle, I believe the means to set your environment variables can be through the CLI as you mentioned, a Python client, a Run Config, or in the environment itself. I believe you can also set them with a YAML file for a container installation of the Agent.
Thank you @Kyle Moon-Wright... this is exactly the kind of thing I had in mind:
Any lowercase Prefect configuration key can be set by environment variable. In order to do so, prefix the variable with
and use two underscores (
) to separate each part of the key.
For example, if you set
, then
prefect.config.tasks.defaults.max_retries == 4
But it doesn't look like the flow environment variables are ever set like
I probably just need to get more comfortable with helm templating and do the
--env Key=VALUE
hmm, this could be a feature request as I believe environment variables defined like
will apply to all your flows globally, rather than be delegated to an individual Agent, whose env vars would need to be configured independently by one of the means mentioned above.
I’ll keep thinking on this though! There may be a hidden way I’m not thinking of…