Thread
#prefect-server
    Sylvain Hazard

    Sylvain Hazard

    9 months ago
    Hello ! I'm not really that fluent in Kubernetes so I figured I should ask here : would a RunNamespacedJob task work for launching CronJobs on my cluster ? I understand that does not necessarily make sense but I'd like to know if it would work 🙂
    davzucky

    davzucky

    9 months ago
    We are using that to kick off our job in K8s. This replace the usage of cronjob. What is good is that perfect give you inside about the job
    Anna Geller

    Anna Geller

    9 months ago
    @davzucky can you share more how you did it? I was just about to write that it doesn’t seem possible because this task seems to expect “Job” kind rather than CronJob, but maybe it’s more nuanced
    davzucky

    davzucky

    9 months ago
    Sure. We are generating our K8s job configuration in our flow and pass it to the Bodie parameter. The job configuration is the same we had with the cronjob. We are using that to kick off spark-summit inside of kubernetes. However if the question is about starting a cronjob manually from perfect the answer is no.
    Anna Geller

    Anna Geller

    9 months ago
    @Sylvain Hazard a formality really but here is a confirmation that you can’ use anything different than kind: Job with this task, including CronJob:
    kubernetes.client.exceptions.ApiException: (400)
    Reason: Bad Request
    HTTP response headers: HTTPHeaderDict({'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': 'cdf51873-6674-4563-8a90-8a6c7da1c979', 'X-Kubernetes-Pf-Prioritylevel-Uid': 'e007fab6-71ca-46cb-a2a8-f128b61e6873', 'Date': 'Tue, 21 Dec 2021 11:37:58 GMT', 'Content-Length': '227'})
    HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"CronJob in version \"v1\" cannot be handled as a Job: converting (v1.CronJob) to (batch.Job): unknown conversion","reason":"BadRequest","code":400}
    Sylvain Hazard

    Sylvain Hazard

    9 months ago
    Thanks to both of you for the answers, I really appreciate !