文档首页 > > API参考> Kubernetes API> Job>

获取指定的Job

获取指定的Job

分享
更新时间:2020/12/16 GMT+08:00

功能介绍

This API is used to read the specified Job.

URI

GET /apis/batch/v1/namespaces/{namespace}/jobs/{name}

表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 Job.

exact

No

Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'.

export

No

Should this value be exported. Export strips fields that a user cannot specify.

请求消息

N/A

响应消息

响应参数:

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

响应示例:

{
    "kind": "Job",
    "apiVersion": "batch/v1",
    "metadata": {
        "name": "example-job",
        "namespace": "default",
        "selfLink": "/apis/batch/v1/namespaces/default/jobs/example-job",
        "uid": "d93a3569-a2be-11e6-a008-fa043d458cc7",
        "resourceVersion": "7482",
        "creationTimestamp": "2016-11-04T18:45:25Z"
    },
    "spec": {
        "parallelism": 1,
        "completions": 1,
        "selector": {
            "matchLabels": {
                "controller-uid": "d93a3569-a2be-11e6-a008-fa043d458cc7"
            }
        },
        "template": {
            "metadata": {
                "name": "example-job",
                "creationTimestamp": null,
                "labels": {
                    "controller-uid": "d93a3569-a2be-11e6-a008-fa043d458cc7",
                    "job-name": "example-job"
                }
            },
            "spec": {
                "containers": [
                    {
                        "name": "pi",
                        "image": "perl",
                        "command": [
                            "perl",
                            "-Mbignum=bpi",
                            "-wle",
                            "print bpi(2000)"
                        ],
                        "resources": {},
                        "terminationMessagePath": "/dev/termination-log",
                        "imagePullPolicy": "Always"
                    }
                ],
                "restartPolicy": "Never",
                "terminationGracePeriodSeconds": 30,
                "dnsPolicy": "ClusterFirst",
                "securityContext": {}
            }
        }
    },
    "status": {
        "startTime": "2016-11-04T18:45:25Z",
        "active": 1
    }
}

状态码

表2描述API的状态码。

表2 状态码

状态码

描述

200

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

异常状态码请参见状态码

分享:

    相关文档

    相关产品