CronJob
apiVersion: batch/v1
import "k8s.io/api/batch/v1"
CronJob
CronJob 代表单个 cron 任务的配置。
apiVersion: batch/v1
kind: CronJob
metadata (ObjectMeta)
标准对象的元数据。更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
spec (CronJobSpec)
cron 任务期望行为的规范,包括计划。更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
status (CronJobStatus)
cron 任务的当前状态。更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
CronJobSpec
CronJobSpec 描述了作业的执行方式以及实际运行时间。
jobTemplate (JobTemplateSpec), required
指定从 CronJob 执行时创建的作业。
JobTemplateSpec 描述了从模板创建 Job 时 Job 应该具有的数据
jobTemplate.metadata (ObjectMeta)
从此模板创建的作业的标准对象元数据。更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
jobTemplate.spec (JobSpec)
作业期望行为的规范。更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
schedule (string), required
Cron 格式的计划,请参阅 https://en.wikipedia.org/wiki/Cron。
timeZone (string)
给定计划的时区名称,请参阅 https://en.wikipedia.org/wiki/List_of_tz_database_time_zones。如果未指定,则默认为 kube-controller-manager 进程的时区。API 服务器在 CronJob 验证期间以及控制器管理器在执行期间从系统范围的时区数据库加载有效时区名称和时区偏移量。如果找不到系统范围的时区数据库,则使用捆绑版本数据库代替。如果时区名称在 CronJob 的生命周期内或由于主机配置更改而变得无效,控制器将停止创建新的作业,并将创建一个带有原因 UnknownTimeZone 的系统事件。更多信息请参见 https://kubernetes.ac.cn/docs/concepts/workloads/controllers/cron-jobs/#time-zones
concurrencyPolicy (string)
指定如何处理 Job 的并发执行。有效值为
- "Allow" (默认): 允许 CronJob 并发运行; - "Forbid": 禁止并发运行,如果之前的运行尚未完成,则跳过下一次运行; - "Replace": 取消当前运行的作业并用新的作业替换它
可能的枚举值
"Allow"允许 CronJob 并发运行。"Forbid"禁止并发运行,如果之前的运行尚未完成,则跳过下一次运行。"Replace"取消当前运行的作业并用新的作业替换它。
startingDeadlineSeconds (int64)
如果由于任何原因错过计划时间,则启动作业的可选截止期限(秒)。错过作业的执行将被计为失败。
suspend (boolean)
此标志告诉控制器暂停后续执行,它不适用于已经启动的执行。默认为 false。
successfulJobsHistoryLimit (int32)
要保留的成功完成的作业数量。值必须是非负整数。默认为 3。
failedJobsHistoryLimit (int32)
要保留的失败完成的作业数量。值必须是非负整数。默认为 1。
CronJobStatus
CronJobStatus 表示 cron 任务的当前状态。
active ([]ObjectReference)
原子:将在合并期间被替换
指向当前正在运行的作业的列表。
lastScheduleTime (Time)
上次成功调度作业的时间信息。
Time 是 time.Time 的包装器,支持正确地编组到 YAML 和 JSON。为时间包提供的许多工厂方法提供包装器。
lastSuccessfulTime (Time)
上次作业成功完成的时间信息。
Time 是 time.Time 的包装器,支持正确地编组到 YAML 和 JSON。为时间包提供的许多工厂方法提供包装器。
CronJobList
CronJobList 是 cron 任务的集合。
apiVersion: batch/v1
kind: CronJobList
metadata (ListMeta)
标准列表元数据。更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
items ([]CronJob), required
items 是 CronJob 的列表。
操作
get 读取指定的 CronJob
HTTP 请求
GET /apis/batch/v1/namespaces/{namespace}/cronjobs/{name}
Parameters
响应
200 (CronJob): OK
401: 未授权
get 读取指定 CronJob 的状态
HTTP 请求
GET /apis/batch/v1/namespaces/{namespace}/cronjobs/{name}/status
Parameters
响应
200 (CronJob): OK
401: 未授权
list 列出或监视 CronJob 类型的对象
HTTP 请求
GET /apis/batch/v1/namespaces/{namespace}/cronjobs
Parameters
namespace (在路径中): string, 必需
allowWatchBookmarks (in query): boolean
continue (in query): string
fieldSelector (in query): string
labelSelector (in query): string
limit (in query): integer
pretty (在查询中): string
resourceVersion (in query): string
resourceVersionMatch (in query): string
sendInitialEvents (in query): boolean
timeoutSeconds (in query): integer
watch (in query): boolean
响应
200 (CronJobList): OK
401: 未授权
list 列出或监视 CronJob 类型的对象
HTTP 请求
GET /apis/batch/v1/cronjobs
Parameters
allowWatchBookmarks (in query): boolean
continue (in query): string
fieldSelector (in query): string
labelSelector (in query): string
limit (in query): integer
pretty (在查询中): string
resourceVersion (in query): string
resourceVersionMatch (in query): string
sendInitialEvents (in query): boolean
timeoutSeconds (in query): integer
watch (in query): boolean
响应
200 (CronJobList): OK
401: 未授权
create 创建 CronJob
HTTP 请求
POST /apis/batch/v1/namespaces/{namespace}/cronjobs
Parameters
namespace (在路径中): string, 必需
body: CronJob, required
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
响应
200 (CronJob): OK
201 (CronJob): Created
202 (CronJob): Accepted
401: 未授权
update 替换指定的 CronJob
HTTP 请求
PUT /apis/batch/v1/namespaces/{namespace}/cronjobs/{name}
Parameters
name (在路径中): string, 必需
CronJob 的名称
namespace (在路径中): string, 必需
body: CronJob, required
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
响应
200 (CronJob): OK
201 (CronJob): Created
401: 未授权
update 替换指定 CronJob 的状态
HTTP 请求
PUT /apis/batch/v1/namespaces/{namespace}/cronjobs/{name}/status
Parameters
name (在路径中): string, 必需
CronJob 的名称
namespace (在路径中): string, 必需
body: CronJob, required
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
响应
200 (CronJob): OK
201 (CronJob): Created
401: 未授权
patch 部分更新指定的 CronJob
HTTP 请求
PATCH /apis/batch/v1/namespaces/{namespace}/cronjobs/{name}
Parameters
name (在路径中): string, 必需
CronJob 的名称
namespace (在路径中): string, 必需
body: Patch, 必需
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
force (in query): boolean
pretty (在查询中): string
响应
200 (CronJob): OK
201 (CronJob): Created
401: 未授权
patch 部分更新指定 CronJob 的状态
HTTP 请求
PATCH /apis/batch/v1/namespaces/{namespace}/cronjobs/{name}/status
Parameters
name (在路径中): string, 必需
CronJob 的名称
namespace (在路径中): string, 必需
body: Patch, 必需
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
force (in query): boolean
pretty (在查询中): string
响应
200 (CronJob): OK
201 (CronJob): Created
401: 未授权
delete 删除 CronJob
HTTP 请求
DELETE /apis/batch/v1/namespaces/{namespace}/cronjobs/{name}
Parameters
name (在路径中): string, 必需
CronJob 的名称
namespace (在路径中): string, 必需
body: DeleteOptions
dryRun (在查询中): string
gracePeriodSeconds (in query): integer
ignoreStoreReadErrorWithClusterBreakingPotential (in query): boolean
pretty (在查询中): string
propagationPolicy (in query): string
响应
200 (Status): 确定
202 (Status): 已接受
401: 未授权
deletecollection 删除 CronJob 集合
HTTP 请求
DELETE /apis/batch/v1/namespaces/{namespace}/cronjobs
Parameters
namespace (在路径中): string, 必需
body: DeleteOptions
continue (in query): string
dryRun (在查询中): string
fieldSelector (in query): string
gracePeriodSeconds (in query): integer
ignoreStoreReadErrorWithClusterBreakingPotential (in query): boolean
labelSelector (in query): string
limit (in query): integer
pretty (在查询中): string
propagationPolicy (in query): string
resourceVersion (in query): string
resourceVersionMatch (in query): string
sendInitialEvents (in query): boolean
timeoutSeconds (in query): integer
响应
200 (Status): 确定
401: 未授权
本页面是自动生成的。
如果您打算报告此页面的问题,请在您的问题描述中提及该页面是自动生成的。修复可能需要在 Kubernetes 项目的其他地方进行。