Reading a Specified Pod
Function
This API is used to query the details about a specified Pod object under a specified Namespace.
URI
GET /api/v1/namespaces/{namespace}/pods/{name}
Table 1 describes the parameters of this API.
|
Name |
Mandatory |
Description |
|---|---|---|
|
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 Pod. |
|
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. |
Request
N/A
Response
Response parameters:
For the description about response parameters, see Table 3.
Example response:
{
"kind": "Pod",
"apiVersion": "v1",
"metadata": {
"name": "hello-world",
"namespace": "default",
"selfLink": "/api/v1/namespaces/default/pods/hello-world",
"uid": "1087023f-59ef-11e6-b444-286ed488fafe",
"resourceVersion": "152187",
"creationTimestamp": "2016-08-04T02:56:39Z",
"labels": {
"name": "brace"
}
},
"spec": {
"volumes": [
{
"name": "test",
"emptyDir": {}
},
{
"name": "default-token-brnb9",
"secret": {
"secretName": "default-token-brnb9"
}
}
],
"containers": [
{
"name": "hello-world",
"image": "test:v1",
"env": [
{
"name": "cy",
"value": "cy"
}
],
"resources": {},
"volumeMounts": [
{
"name": "test",
"mountPath": "/tmp/foo"
},
{
"name": "default-token-brnb9",
"readOnly": true,
"mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
}
],
"terminationMessagePath": "/dev/termination-log",
"imagePullPolicy": "IfNotPresent"
}
],
"restartPolicy": "Always",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"serviceAccountName": "default",
"serviceAccount": "default",
"nodeName": "127.0.0.1",
"securityContext": {}
},
"status": {
"phase": "Running",
"conditions": [
{
"type": "Ready",
"status": "True",
"lastProbeTime": null,
"lastTransitionTime": "2016-08-04T02:56:40Z"
}
],
"hostIP": "127.0.0.1",
"podIP": "172.16.0.4",
"startTime": "2016-08-04T02:56:39Z",
"containerStatuses": [
{
"name": "hello-world",
"state": {
"running": {
"startedAt": "2016-08-04T02:56:39Z"
}
},
"lastState": {},
"ready": true,
"restartCount": 0,
"image": "test:v1",
"imageID": "docker://sha256:b38119b54befb956986a4f5fb6f6eb79c9a1a4d94bbb8ad5fee82f5c1175e5b9",
"containerID": "docker://c1d60a8653c4df7362d330d6d9d7d630179a01ae64cc9b7aeae70369040e6d30"
}
]
}
}
Status Code
Table 2 describes the status code of this API.
|
Status Code |
Description |
|---|---|
|
200 |
This operation succeeds, and a Pod resource object is returned. |
For the description about status codes, see section Status Code.
Last Article: Deleting All Pods
Next Article: Replacing a Specified Pod
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.