从kubernetes .yaml文件中的cronjob创建作业 [英] Create job from cronjob in kubernetes .yaml file

查看:66
本文介绍了从kubernetes .yaml文件中的cronjob创建作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在kubernetes中执行从cronjob创建的作业.手动,我可以这样运行它:

I need to execute a job create from cronjob in kubernetes. Manualy I can run it like this:

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

尽管我不确定如何将其翻译为yaml.

Though I'm not sure how to translate this to yaml.

大概我需要在中输入以下内容:部分,但我不确定如何操作.

Probably I need to put a from: section in the spec ,but I'm not sure how.

推荐答案

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

您只能使用上述方法启动已声明的cronjob的作业执行,更重要的是(不幸的是,这对您而言)-您只能使用kubectl cli 来做到这一点.

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

这篇关于从kubernetes .yaml文件中的cronjob创建作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆