Hi! We are running a POC on kubernetes. I have a f...
# prefect-server
j
Hi! We are running a POC on kubernetes. I have a flow that we want to run in k8s:
Copy code
environment = KubernetesJobEnvironment(job_spec_file=f"{local_dir_path}/job_spec.yaml")
...
with Flow("k8s-example-flow", storage=storage, environment=environment) as flow:
    ...

flow.register(project_name="Test Project")
However when the job is scheduled via the UI, the k8s job spec does not match the one I generated and filled in the
job_spec_file
. I understand that some properties will be overwritten, but no env vars or resource requests/limits are coming through. Any pointers?
j
Hi @JC Garcia when the kubernetes agent picks up a flow to be run it first creates a
prefect-job
that is responsible for pulling your flow’s environment and then creating the Kubernetes job that you set as the flow’s environment. Are you running into an issue with the initial
prefect-job
? This is actually something we are phasing out with the addition of the new RunConfig pattern (docs aren’t fully written yet and it’s still experimental). reference
j
Not with the initial job with the k8s agent, but rather with the KubernetesJobEnvironment. We set the
job_spec_file
but it does not use it
j
Hmm could you open an issue on the repo with some more information? I don’t think that code has been touched in a long while 🤔
j
so what would be the current best-practice for running flows as k8s jobs? is it the run config you mentioned?
j
The current method is still using environments however the run config stuff is an experimental new way of doing it. Keep in mind that the KubernetesJobEvironment isn’t necessary for running flows as k8s jobs unless you need fine grained control over the job yaml spec. (the default LocalEnvironment will still run flows that are shipped off by the kubernetes agent) If you want you could always try out the KubernetesRun to test it out (we believe the experience will be better) but it’s still experimental and is subject to change in the future 🙂
j
got it... yeah I got it running just fine in k8s for a simple flow without specifying the
job_spec_file
I'll dig through the code and see what the issue might be
j
Awesome yeah that sounds like it could be a bug if it’s not respecting the file!
j
thanks Josh!
@josh It's working fine, a dependency error was not letting the initial k8s job go through