Deleting a Specified PersistentVolume
Function
This API is used to delete a specified PersistentVolume.
URI
DELETE /api/v1/persistentvolumes/{name}
Table 1 describes the parameters of this API.
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
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. |
|
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 2.
Example request:
{
"kind": "DeleteOptions",
"apiVersion": "v1",
"gracePeriodSeconds": 0
}
Response
Response parameters:
For the description about response parameters, see Table 2.
Example response:
The following is an example of a cluster of 1.15 or later:
{
"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-7",
"failure-domain.beta.kubernetes.io/zone": "cn-north-7b"
},
"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": "SATA",
"storage.kubernetes.io/csiProvisionerIdentity": "everest-csi-provisioner"
},
"volumeHandle": "9c44d068-42ab-4fcf-bb8f-1609823da5bb"
},
"persistentVolumeReclaimPolicy": "Delete",
"storageClassName": "csi-disk",
"volumeMode": "Filesystem"
},
"status": {
"phase": "Released"
}
}
Example for clusters of version 1.13 or earlier:
{
"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": "sata",
"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"
}
}
Status Code
Table 2 describes the status code of this API.
|
Status Code |
Description |
|---|---|
|
200 |
Delete a specified PersistentVolume resource object successfully. |
For the description about error status codes, see Status Code.
Last Article: Creating a PersistentVolume
Next Article: Deleting All PersistentVolumes
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.