Hi there - I've opened <https://github.com/Prefect...
# prefect-contributors
m
Hi there - I've opened https://github.com/PrefectHQ/prefect/pull/3046, would love some advice on tests/docs required or if this is the right approach.
l
Hi @Matt Wong-Kemp! I think there is some overlap here with your PR and the KubernetesJobEnvironment — have you used that yet? That being said, we are in talks to find a way to merge environments/agents (though if you check this thread above there is some debate still which way to go, subsume environments in agents [like your PR kind of does] or make a single, backend agnostic agent).
m
Hi @Laura Lorenz (she/her) - I haven't, what would happen if I were to use a k8s environment inside a k8s agent? my understanding from reading the cost is that will make a job that then makes a job?
l
Yes, it’s a little confusing (I have to look it up every time haha…) but using the environment there are at least two jobs created - a job created to make the FlowRunner (that orchestrates the flow) like the k8s agent normally does, and then job(s) created for individual TaskRunners that each run a task
m
so the problem I have is that we have container injection runninginserting a sidecar. At the minute the flow job ends, but because the sidecar is still running it leaves a dangling resource. What i've done is to modify the job that is launched to kill the sidecar container when the flow finishes. In this case, using the KubernetesJobEnvironment wouldn't work, - I would be able to remove the sidecar from the inner-launched job, but not from the job launched by the k8s agent. I guess alternately I could use a local agent with a k8s job environment, but it starts getting a bit off-piste - I haven't seen any examples of how to deploy a local agent into k8s