Has anyone had success with a single agent deploym...
# ask-community
l
Has anyone had success with a single agent deployment handling multiple environments via labels? (more info in thread)
Lets say there is 1 single agent deployment with both
dev
and
prod
label to serve both “environments”
Each set of flows could be grouped in a project say
dev-xyz
and
prod-xyz
to separate deployments, but when a flow is deployed to
dev-xyz
the label
dev
is used, and
prod
for the other
k
Hey @Leon Kozlowski, I’m not sure I am following 100%. Is there a use labelling dev and prod if they end up going to the same underlying compute? It will work though if your agent has labels
dev
and
prod
since flow labels just need to be a subset of the agent labels. Or is the main question how to assign
dev
to the flow if it’s in the
dev-xyz
project and
prod
automatically if it’s in the
prod-xyz
project?
l
I want to use a different set of secrets for dev and prod + the question is, is it an antipattern for them to exist on the same cluster
k
Ah ok do you have multiple tenants? I think it is an anti-pattern, but i can understand why it makes sense if you are changing all the connections and secrets.
l
No, do not have multiple tenants, the real problem is that were just using 1 cluster
If there were 2 clusters, I’d just deploy 2 agents, one dev and one prod - and it would be pretty simple
k
Oh I see what you mean, and then you’d just set the environment variables different for those agents? Well, what if you have one cluster that has two
config.toml
files and you put secrets there, and then set
prefect.config.user_config_path
to point to the corresponding
config.toml
file for dev and prod. And then you can start 2 agents on the same machine with different env variables and secrets?
l
Acutally, could this just be done with namespaces?
this is for k8s btw, specifically an eks cluster
I guess the question there is, can the agent live in a different namespace than where the jobs are run
k
I would imagine so, but not 100% sure because I’m not that good at kubernetes myself. But I see it working since you can have a different configuration for each namespace yep. Then you would have one agent per namespace right?
Oh I was thinking you would just make the
dev
agent and the
prod
agent in different namespaces then they would pick up the appropriate flows?
l
that would be ideal, but its somewhat out of scope for our helm workflow that were using to deploy the agent - I’ll see if I can make that happen - thanks @Kevin Kho
👍 1
Update: actually figured out the helm part, appreciate you thinking this out with me
k
Glad you got it working 👍