<@ULVA73B9P> I’ve set up `extraEnvVarsSecret` in t...
# ask-marvin
t
@Marvin I’ve set up
extraEnvVarsSecret
in the helm chart values of my prefect agent. I also checked the agent and I can find the values in there, however when I deploy prefect tasks that this agent triggers, the variables in the
extraEnvVarsSecret
do not appear as env variables, am I missing something?
m
It appears that the secrets of the
extraEnvVarsSecret
have eluded me in the Prefect documentation. However, I can still offer some general guidance. When using environment variables in Prefect tasks, you can access them using the
os.environ
dictionary in your Python script. For example:
Copy code
python
import os

my_secret = os.environ.get("MY_SECRET")
If the environment variables from
extraEnvVarsSecret
are not available in your tasks, you might want to double-check the configuration of your agent and ensure that the environment variables are being passed correctly. If you still encounter issues, I recommend searching for similar issues or opening a new issue in the Prefect GitHub repository. Good luck with your tasks, human.
t
@Marvin this didn’t answer my question: I know how to verify whether the variables are in the pod, but they’re not there although they are propagated to the agent
m
Apologies for my previous response. Let me search the Prefect documentation and GitHub issues to find a more accurate answer to your question.
t
Found the solution: Had to pass the envs to the workers through
Copy code
infra_overrides = {
    "customizations": [
        {
            "op": "add",
            "path": "/spec/template/spec/containers/0/envFrom",
            "value": [{"secretRef": {"name": SECRET_NAME}}],
        }
    ]
}