删除指定的PersistentVolume
功能介绍
该API用于删除指定的PersistentVolume对象。
URI
DELETE /api/v1/persistentvolumes/{name}
表1 描述该API的参数。
参数 |
是否必选 |
描述 |
---|---|---|
name |
Yes |
Name of the PersistentVolume. |
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 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. |
请求消息
请求参数:
请求参数的详细描述请参见表2.
请求示例:
{ "kind": "DeleteOptions", "apiVersion": "v1", "gracePeriodSeconds": 0 }
响应消息
响应参数:
响应参数的详细描述请参见表2。
响应示例:
1.15及以上版本集群,示例如下:
{ "apiVersion": "v1", "kind": "PersistentVolume", "metadata": { "annotations": { "pv.kubernetes.io/provisioned-by": "everest-csi-provisioner" }, "creationTimestamp": "2020-01-08T02:00:31Z", "deletionGracePeriodSeconds": 0, "deletionTimestamp": "2020-01-13T02:04:12Z", "finalizers": [ "everest-csi-attacher/disk-csi-everest-io" ], "labels": { "failure-domain.beta.kubernetes.io/region": "cn-north-4", "failure-domain.beta.kubernetes.io/zone": "cn-north-4b" }, "name": "pvc-efe92ec5-fb39-4e17-bb26-c5d336ce5c14", "resourceVersion": "5025500", "selfLink": "/api/v1/persistentvolumes/pvc-efe92ec5-fb39-4e17-bb26-c5d336ce5c14", "uid": "b14a40bc-8be7-4b26-90e5-975261d470a2" }, "spec": { "accessModes": [ "ReadWriteOnce" ], "capacity": { "storage": "20Gi" }, "claimRef": { "apiVersion": "v1", "kind": "PersistentVolumeClaim", "name": "cce-evs-k54nobs9-ljhc", "namespace": "default", "resourceVersion": "3578282", "uid": "efe92ec5-fb39-4e17-bb26-c5d336ce5c14" }, "csi": { "driver": "disk.csi.everest.io", "fsType": "ext4", "volumeAttributes": { "everest.io/disk-mode": "SCSI", "everest.io/disk-volume-type": "SAS", "storage.kubernetes.io/csiProvisionerIdentity": "everest-csi-provisioner" }, "volumeHandle": "9c44d068-42ab-4fcf-bb8f-1609823da5bb" }, "persistentVolumeReclaimPolicy": "Delete", "storageClassName": "csi-disk", "volumeMode": "Filesystem" }, "status": { "phase": "Released" } }
1.13及之前集群版本示例:
{ "kind": "PersistentVolume", "apiVersion": "v1", "metadata": { "name": "pv-test-02", "generateName": "pv-demo", "namespace": "default", "selfLink": "/api/v1/namespaces/default/persistentvolumes/pv-test-02", "uid": "98efd6aa-920a-11e8-81cc-fa163e49263c", "resourceVersion": "5674455", "creationTimestamp": "2018-07-28T02:04:44Z", "labels": { "failure-domain.beta.kubernetes.io/region": "cn-north-4", "failure-domain.beta.kubernetes.io/zone": "cn-north-4a", "name": "pv-test-03" }, "annotations": { "pv.kubernetes.io/bound-by-controller": "yes", "volume.beta.kubernetes.io/storage-class": "SAS", "volume.beta.kubernetes.io/storage-provisioner": "flexvolume-huawei.com/fuxivol" } }, "spec": { "capacity": { "storage": "11Gi" }, "hostPath": { "path": "/home", "type": "" }, "accessModes": [ "ReadWriteMany" ], "claimRef": { "kind": "PersistentVolumeClaim", "namespace": "default", "name": "db-mysql", "uid": "638e26ac-9148-11e8-8cd0-fa163e082286", "apiVersion": "v1", "resourceVersion": "5456583" }, "persistentVolumeReclaimPolicy": "Delete" }, "status": { "phase": "Bound" } }
