https://prefect.io logo
r

Roman Zydyk

08/31/2023, 7:49 PM
Hi, what is the general workflow when using kubernetes worker? How it works, please? I would like to execute python code that is located in gitlab. The worker would clone the project everytime it is scheduled and run the app? Or it is better to already have all the codes/apps present on the disk in the kubernetes pod? Or the pod start a container in itself and executes the app there? Or what is the process, please?
g

Gregory Hunt

08/31/2023, 7:50 PM
You can do all of those things, just depends on how you want to deploy it
r

Roman Zydyk

08/31/2023, 7:51 PM
Is there any best practice or recommendations on how to do this?
g

Gregory Hunt

08/31/2023, 7:52 PM
What I am doing is building a container, that is very light weight with my code baked in,
But if you don't want that overhead, you can use the prefect default container and just clone the repo
r

Roman Zydyk

08/31/2023, 7:53 PM
I like your approach
How that could be done, please?
I thought that you have to have a kubernetes worker that would listen to jobs. But how do you create a container with your job?
g

Gregory Hunt

08/31/2023, 7:54 PM
that is correct
You use the prefect container for the worker
the in you deployment or work pool set the image of for the job to use
🤔 1
r

Roman Zydyk

08/31/2023, 7:58 PM
So everytime your app is scheduled to run prefect spawns a new pod or container in your cluster?
g

Gregory Hunt

08/31/2023, 7:59 PM
correct, it is an k8s job, pod technically
r

Roman Zydyk

08/31/2023, 7:59 PM
nice, I like that
would you have some example somewhere by any chance?
btw. do you specify storage, path or entrypoint in your deployment yaml? I suppose not since there is already pod specification? I.e. you already specified image and entrypoint and therefore there is no need for these variables?