Deleting a Pod
Function
This API is used to delete a specified pod.
URI
DELETE /api/v1/namespaces/{namespace}/pods/{name}
|
Parameter |
Description |
|---|---|
|
namespace |
Object name and auth scope, such as for teams and projects. |
|
name |
Name of the Pod. |
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
pretty |
No |
If 'true', then the output is pretty printed. |
|
gracePeriodSeconds |
No |
The duration in seconds before the object should be deleted. Value must be a non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. |
|
orphanDependents |
No |
Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. |
|
propagationPolicy |
No |
Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. |
Request
Request parameters
For the description about request parameters, see Table 64.
Example request
{
"kind": "DeleteOptions",
"apiVersion": "v1",
"gracePeriodSeconds": 10
}
Response
Response parameters
For the description about response parameters, see Table 72.
Example response
{
"kind": "PodList",
"apiVersion": "v1",
"metadata": {
"selfLink": "/api/v1/namespaces/namespace-test/pods",
"resourceVersion": "5035636"
},
"items": [
{
"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": {
"network.alpha.kubernetes.io/network": "[{\"name\":\"namespace-test-dc1-default-network\",\"interface\":\"eth0\",\"network_plane\":\"default\"}]",
"cri.cci.io/container-type": "secure-container",
"kubernetes.io/availablezone": "dc1"
},
"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"
}
}
]
}
Last Article: Updating a Pod
Next Article: Deleting All Pods
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.