Hi everyone! My name is Eike and I am an software ...
# introductions
e
Hi everyone! My name is Eike and I am an software engineer and want to integrate prefect via pygeoapi into an spatial data infrastructure running in an k8s cluster. In the end, I would like to run various processes with different infrastructure requirements (GPU, CPU, RAM, ...).
catjam 5
πŸ‘‹ 6
🌍 3
n
πŸ‘‹ @Eike - welcome! once you're ready to set up your flows to run on kubernetes, this might be a good resource for you! similarly, here's an toy e2e example of setting up a cluster and worker and running some flows against it, just for demonstration of what pieces are involved in the minimal case
n
in general, folks usually keep their worker alive at all times, though for other infrastructures (cloud run, ECS etc) we have a concept of push pools which do not require you to run a worker.
upvote 2
e
Okay, push pools sound like the required concept.
But they do not support a generic kubernetes environment, right?
n
correct.
b
Welcome Eike! Great to have you here πŸ‘‹ ✨
e
So, it is not possible to have a work-pool with 0 workers and the prefect server triggers the start of an worker if any flow in the pool should be executed!? This should include the downscaling to 0 workers if not jobs/flows are queued for the according pool.
n
you may be interested to read the original (somewhat old at this point) ideas behind the hybrid model, but yea you need something in your client-side / runtime infrastructure asking the prefect server if there's work to spin up in the kubernetes case, its a pod that asks the server if it should spin up another pod for a flow run (so it scales down to 1)
however there's no reason that you couldn't manage your worker pods lifetime yourself by interacting with kubernetes, thats just not a common pattern since people often have a regular delivery of work when using k8s
k
just to clarify, in the prefect + k8s scenario you're likely thinking of, "workers" are not the things that run your flows or need to scale in any way. They're essentially a messenger between the Prefect server and your flow run jobs and pods, so a worker can be a relatively small pod, but it should be on all the time. Flow run pods that need things like GPUs will still scale up and down the way you're expecting
e
I am slowly achieving this understanding. But it is unclear to may how this interacts with k8s autoscaler, k8s jobs and stuff. How does this match with the work-pool per infrastructure type idea?
I saw some k8s job templates, but cannot find the according documentation anymore. This might be the part that solves the problem, right?!