文档首页 > > API参考> Kubernetes API> Pod> 列出用户所有的Pod

列出用户所有的Pod

分享
更新时间: 2019/05/09 GMT+08:00

功能介绍

该API用于获取一个Pod列表。

URI

GET /api/v1/pods

表1 参数描述

参数

是否必选

描述

pretty

No

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

labelSelector

No

A selector to restrict the list of returned objects by their labels. Defaults to everything.

includeUninitialized

No

If true, partially initialized resources are included in the response.

fieldSelector

No

A selector to restrict the list of returned objects by their fields. Defaults to everything.

watch

No

Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.

resourceVersion

No

When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.

timeoutSeconds

No

Timeout for the list/watch call.

请求消息

N/A

响应消息

响应参数:

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

响应示例:

{
    "kind": "PodList",
    "apiVersion": "v1",
    "metadata": {
        "selfLink": "/api/v1/pods",
        "resourceVersion": "1550321"
    },
    "items": [
        {
            "metadata": {
                "name": "fdsfsd-ddnft",
                "generateName": "fdsfsd-",
                "namespace": "default",
                "selfLink": "/api/v1/namespaces/default/pods/fdsfsd-ddnft",
                "uid": "753a45bc-57c4-11e7-afb7-fa163e218692",
                "resourceVersion": "1449034",
                "creationTimestamp": "2017-06-23T03:31:35Z",
                "labels": {
                    "cce/appgroup": "gfsad",
                    "name": "fdsfsd"
                },
                "annotations": {
                    "kubernetes.io/created-by": "{\"kind\":\"SerializedReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"ReplicationController\",\"namespace\":\"default\",\"name\":\"fdsfsd\",\"uid\":\"7539c329-57c4-11e7-afb7-fa163e218692\",\"apiVersion\":\"v1\",\"resourceVersion\":\"956153\"}}\n",
                    "kubernetes.io/limit-ranger": "LimitRanger plugin set: cpu request for container container01"
                },
                "ownerReferences": [
                    {
                        "apiVersion": "v1",
                        "kind": "ReplicationController",
                        "name": "fdsfsd",
                        "uid": "7539c329-57c4-11e7-afb7-fa163e218692",
                        "controller": true
                    }
                ]
            },
            "spec": {
                "volumes": [
                    {
                        "name": "default-token-863rh",
                        "secret": {
                            "secretName": "default-token-863rh",
                            "defaultMode": 420
                        }
                    }
                ],
                "containers": [
                    {
                        "name": "container01",
                        "image": "10.154.52.159:443/test/apache-php:latest",
                        "ports": [
                            {
                                "containerPort": 80,
                                "protocol": "TCP"
                            }
                        ],
                        "resources": {
                            "requests": {
                                "cpu": "100m"
                            }
                        },
                        "volumeMounts": [
                            {
                                "name": "default-token-863rh",
                                "readOnly": true,
                                "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
                            }
                        ],
                        "terminationMessagePath": "/dev/termination-log",
                        "imagePullPolicy": "Always"
                    }
                ],
                "restartPolicy": "Always",
                "terminationGracePeriodSeconds": 30,
                "dnsPolicy": "ClusterFirst",
                "serviceAccountName": "default",
                "serviceAccount": "default",
                "nodeName": "192.168.12.187",
                "securityContext": {},
                "imagePullSecrets": [
                    {
                        "name": "myregistry"
                    }
                ]
            },
            "status": {
                "phase": "Running",
                "conditions": [
                    {
                        "type": "Initialized",
                        "status": "True",
                        "lastProbeTime": null,
                        "lastTransitionTime": "2017-06-23T03:31:36Z"
                    },
                    {
                        "type": "Ready",
                        "status": "True",
                        "lastProbeTime": null,
                        "lastTransitionTime": "2017-06-28T06:34:51Z"
                    },
                    {
                        "type": "PodScheduled",
                        "status": "True",
                        "lastProbeTime": null,
                        "lastTransitionTime": "2017-06-23T03:31:35Z"
                    }
                ],
                "hostIP": "192.168.12.187",
                "podIP": "172.16.56.4",
                "startTime": "2017-06-23T03:31:36Z",
                "containerStatuses": [
                    {
                        "name": "container01",
                        "state": {
                            "running": {
                                "startedAt": "2017-06-28T06:34:46Z"
                            }
                        },
                        "lastState": {},
                        "ready": true,
                        "restartCount": 0,
                        "image": "10.154.52.159:443/test/apache-php:latest",
                        "imageID": "docker://sha256:2e233ad9329bd7f65572dd6acb1a03e8839c36abfdb1d1f9012d84d13cecf9fc",
                        "containerID": "docker://f3daa802f753d123fe66b2cba2e917725702f8d446c17541822a68f9d2414c6d"
                    }
                ]
            }
        }
    ]
}

状态码

表2 状态码

状态码

描述

200

This operation succeeds, and the JSONs of a group of Pod objects are returned.

分享:

    相关文档

    相关产品

文档是否有解决您的问题?

提交成功!

非常感谢您的反馈,我们会继续努力做到更好!

反馈提交失败,请稍后再试!

*必选

请至少选择或填写一项反馈信息

字符长度不能超过200

提交反馈 取消

如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨

跳转到云社区