Create job from cronjob in kubernetes .yaml file Create job from cronjob in kubernetes .yaml file kubernetes kubernetes

Create job from cronjob in kubernetes .yaml file


kubectl create job manual-job --from=cronjob/some-cronjob

You can use above method only to launch a job execution of a declared cronjob and whats more important(unfortunately for you) - you are able to that only using kubectl cli.

During research I also found my answer on a similar question Kubernetes Run job using CronJob. There is also try in that example to achieve very similar thing as you trying to rich(but vise-versa. In the provided example there is a try to create cronjob bases on already existed job)..

  jobTemplate:    spec:      labelSelector:        name: pi # refer to the job created above

Both of your questions make sense, it would be very useful to have such an option, but, as I said in the beginning - that's currently not possible.

For test purposed - use provided command.

For regular usage - currently have no idea how to help you. Hope future releases will add this feature