Reading the Status of a Pod

Function

This API is used to read the status of a specified pod.

URI

GET /api/v1/namespaces/{namespace}/pods/{name}/status

Path parameters

Table 1 Path parameters

Parameter

Description

namespace

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

name

Name of the Pod.

Table 2 Query parameter

Parameter

Mandatory

Description

pretty

No

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

Response

Response parameters

For the description about response parameters, see Table 2.

Example response

{
    "kind": "Pod",
    "apiVersion": "v1",
    "metadata": {
        "name": "pod-test",
        "namespace": "namespace-test",
        "selfLink": "/api/v1/namespaces/namespace-test/pods/pod-test",
        "uid": "8b985a27-af74-11e8-9d5d-c88d83be759f",
        "resourceVersion": "5030610",
        "creationTimestamp": "2018-09-03T12:26:12Z",
        "labels": {
            "name": "pod-test"
        },
        "annotations": {
            "cri.cci.io/container-type": "secure-container",
            "kubernetes.io/availablezone": "dc1",
            "network.alpha.kubernetes.io/network": "[{\"name\":\"namespace-test-dc1-default-network\",\"interface\":\"eth0\",\"network_plane\":\"default\"}]"
        },
        "enable": true
    },
    "spec": {
        "containers": [
            {
                "name": "test",
                "image": "redis",
                "resources": {
                    "limits": {
                        "cpu": "500m",
                        "memory": "1Gi"
                    },
                    "requests": {
                        "cpu": "500m",
                        "memory": "1Gi"
                    }
                },
                "terminationMessagePath": "/dev/termination-log",
                "terminationMessagePolicy": "File",
                "imagePullPolicy": "Always"
            }
        ],
        "restartPolicy": "Always",
        "terminationGracePeriodSeconds": 30,
        "dnsPolicy": "ClusterFirst",
        "nodeName": "c0dd6256-195a-e811-90a2-10c17294fcbc",
        "securityContext": {},
        "imagePullSecrets": [
            {
                "name": "imagepull-secret"
            }
        ],
        "schedulerName": "default-scheduler",
        "tolerations": [
            {
                "key": "node.kubernetes.io/not-ready",
                "operator": "Exists",
                "effect": "NoExecute",
                "tolerationSeconds": 300
            },
            {
                "key": "node.kubernetes.io/unreachable",
                "operator": "Exists",
                "effect": "NoExecute",
                "tolerationSeconds": 300
            }
        ]
    },
    "status": {
        "phase": "Running",
        "conditions": [
            {
                "type": "Initialized",
                "status": "True",
                "lastProbeTime": null,
                "lastTransitionTime": "2018-09-03T12:26:12Z"
            },
            {
                "type": "Ready",
                "status": "True",
                "lastProbeTime": null,
                "lastTransitionTime": "2018-09-03T12:26:16Z"
            },
            {
                "type": "PodScheduled",
                "status": "True",
                "lastProbeTime": null,
                "lastTransitionTime": "2018-09-03T12:26:12Z"
            }
        ],
        "podIP": "192.168.245.185",
        "startTime": "2018-09-03T12:26:12Z",
        "containerStatuses": [
            {
                "name": "test",
                "state": {
                    "running": {
                        "startedAt": "2018-09-03T12:26:16Z"
                    }
                },
                "lastState": {},
                "ready": true,
                "restartCount": 0,
                "image": "redis",
                "imageID": "docker-pullable://redis@sha256:3ab7046bd035a47aa06963d8240651d00b57e82dab07ba374ad01f84dfa1230c",
                "containerID": "docker://aee55d8dedb8371f96aa5d5116f69a53bf1cb23afe1802567c24081514d3b048"
            }
        ],
        "qosClass": "Guaranteed",
        "managementIP": "172.28.0.17"
    }
}

Status Code

Table 3 describes the status code of this API.

Table 3 Status code

Status Code

Description

200

This operation succeeds, and the JSON of a Pod object is returned.

For more status codes, see Status Codes.