Hi! For Kubernetes agent, is there a way to set en...
# ask-community
s
Hi! For Kubernetes agent, is there a way to set environment variables in the Kubernetes jobs that are spun up by prefect agent pod?
I’m referring to storing secrets as environment variables, so we’d like to avoid using the env vars parameter in run config.
Technically, we can use Prefect secret, but wondering if it’s possible to specify env vars for Kuberentes jobs in Kubernetes configs(helm chart)
k
On the agent when you do the
install
, you can use the
--env
flag. This will add the env var to the flows spun by the agent.
But I honestly think PrefectSecret is easier to deal with
s
Thank you! I’ll give it a shot
confirmed it works!
Copy code
prefect agent kubernetes install --env myenv="22"
will introduce a new environment variable
PREFECT__CLOUD__AGENT__ENV_VARS
and you can add the env vars you’d like to see in Kubernetes Jobs as a JSON file.
👍 2