文档首页> 云容器引擎 CCE> API参考> Kubernetes API> CronJob> 获取指定的CronJob的状态
更新时间:2022-05-10 GMT+08:00
分享

获取指定的CronJob的状态

功能介绍

This API is used to read the status of the specified CronJob.

URI

GET /apis/batch/v1/namespaces/{namespace}/cronjobs/{name}/status (Supports 1.21 and 1.21+)

GET /apis/batch/v1beta1/namespaces/{namespace}/cronjobs/{name}/status (Supports 1.21-)

表1描述该API的参数。

表1 参数解释

参数

是否必选

描述

pretty

No

If 'true', then the output is pretty printed.

namespace

Yes

Object name and auth scope, such as for teams and projects.

name

Yes

Name of the CronJob.

请求消息

N/A

响应消息

响应参数:

响应参数的详细描述请参见表2

响应示例:

{
  "kind": "CronJob",
  "apiVersion": "batch/v1beta1",
  "metadata": {
    "name": "cronjob-test",
    "namespace": "default",
    "selfLink": "/apis/batch/v1beta1/namespaces/default/cronjobs/cronjob-test/status",
    "uid": "7cf2c54b-2201-11e8-96aa-fa163ecd089c",
    "resourceVersion": "441600",
    "creationTimestamp": "2018-03-07T12:17:22Z",
    "enable": true
  },
  "spec": {
    "schedule": "*/59 * * * *",
    "concurrencyPolicy": "Allow",
    "suspend": false,
    "jobTemplate": {
      "metadata": {
        "creationTimestamp": null,
        "enable": true
      },
      "spec": {
        "template": {
          "metadata": {
            "creationTimestamp": null,
            "labels": {
              "sjname": "cronjob-test"
            },
            "enable": true
          },
          "spec": {
            "containers": [
              {
                "name": "container-0",
                "image": "nginx:stable-perl",
                "resources": {

                },
                "lifecycle": {

                },
                "terminationMessagePath": "/dev/termination-log",
                "terminationMessagePolicy": "File",
                "imagePullPolicy": "IfNotPresent"
              }
            ],
            "restartPolicy": "OnFailure",
            "terminationGracePeriodSeconds": 30,
            "dnsPolicy": "ClusterFirst",
            "securityContext": {

            },
            "imagePullSecrets": [
              {
                "name": "default-secret"
              }
            ],
            "schedulerName": "default-scheduler"
          }
        }
      }
    },
    "successfulJobsHistoryLimit": 3,
    "failedJobsHistoryLimit": 1
  },
  "status": {

  }
}

状态码

表2描述API的状态码。

表2 状态码

状态码

描述

200

This operation succeeds, and a CronJob resource object is returned.

异常状态码请参见状态码

分享:

    相关文档

    相关产品

close