Shaoyi Zhang

03/16/2022, 11:56 PM
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)

Kevin Kho

03/17/2022, 12:01 AM
On the agent when you do the
, you can use the
flag. This will add the env var to the flows spun by the agent.
But I honestly think PrefectSecret is easier to deal with

Shaoyi Zhang

03/17/2022, 12:05 AM
Thank you! I’ll give it a shot
confirmed it works!
prefect agent kubernetes install --env myenv="22"
will introduce a new environment variable
and you can add the env vars you’d like to see in Kubernetes Jobs as a JSON file.
👍 2