<@ULVA73B9P> Hey, i’m using k8s job block and have...
# ask-marvin
h
@Marvin Hey, i’m using k8s job block and have a docker image with an entrypoint. Can I use the k8s job block to create a flow that triggers this docker image (docker run actually)?
m
Yes, you can use the Kubernetes job block in Prefect to create a flow that triggers your Docker image. You can specify the Docker container image you want to use for your jobs within the Kubernetes job block configuration: - In the
Image
field of the job block, specify the Docker image you want to use. If you have an entrypoint defined for your Docker image, it will be executed when the job is run. - If your Docker image is not set to pull by default, you might want to adjust the
Image Pull Policy
to ensure the correct version of your image is used. - Make sure to use unique image tags with the
IfNotPresent
policy to avoid using old images cached on your Kubernetes nodes. For more specific guidance or to address additional details about running Docker commands or image entry points within the Prefect Kubernetes job blocks, please refer to the Prefect documentation or consider adjusting the deployment configurations using
job_variables
. Here's a reference link to the Kubernetes Deployment documentation.
👍 1
h
@Marvin and can I see the logs of this k8s job in the flow run logs in Prefect UI?
m
Yes, after you run deployments in Kubernetes, you can head over to the Prefect UI to check the status, look at the flow run graph, and view logs. The logs of your Kubernetes jobs should appear on the Flow Run page in the UI. This means you should be able to see the output from your Docker image execution if it was triggered as part of the flow run. Here's a quick start guide for more details on deploying flows and using the Prefect UI. Keep in mind that the logs may take a minute to show up as the infrastructure spins up to run the flow.