How to customize Kubernetes jobs with customizations applied to the KubernetesJob infrastructure block?

Getting the default Kubernetes job template

First, run:

prefect kubernetes manifest flow-run-job

This will generate:

apiVersion: batch/v1
kind: Job
metadata:
  # labels are required, even if empty
  labels: {}
spec:
  template:
    spec:
      containers:  # the first container is required
      - env: []  # env is required, even if empty
        name: prefect-job

Then, you can provide custom inline customizations as shown in the examples linked in the repo:

As a side note, when specifying a resource request customization, if /spec/template/spec/resources doesn’t work for you, try /spec/template/spec/containers/0/resources.

1 Like