Hey prefect team, Great job on getting to 2.0 GA...
# prefect-community
r
Hey prefect team, Great job on getting to 2.0 GA !!!! I had question about the new deployment method is there example where I can easily add a customizations to a K8 job without going into the ui and creating k8 job block? Previously all i had to do was import the k8 job create a deployment and pass my customizations to it.
1
👀 2
a
yes, 100% - I started compiling examples here but will add more soon https://github.com/anna-geller/prefect-deployment-patterns/tree/main/k8s
🙏 1
if you want to create it via code, you can:
Copy code
from prefect.infrastructure import KubernetesJob
k8s_job = KubernetesJob(
    command=["echo", "hello"],
    namespace="dev",
    customizations=[
        {
            "op": "add",
            "path": "/spec/template/spec/containers/0/command/0",
            "value": "opentelemetry-instrument",
        },
        {
            "op": "add",
            "path": "/spec/template/spec/containers/0/command/1",
            "value": "--resource_attributes",
        },
        {
            "op": "add",
            "path": "/spec/template/spec/containers/0/command/2",
            "value": "service.name=my-cool-job",
        },
    ],
)
k8s_job.save("append-commands")
Out[15]: UUID('5b0504f9-f4bc-4f0c-a814-9dd6a79b04a6')
UI will then display it
🙌 1
gratitude thank you 1