Updating a Specified PersistentVolume
Function
This API is used to update a PersistentVolume.
The following fields can be updated:
- metadata.labels
- metadata.generateName
- spec.accessModes
- spec.capacity
- spec.persistentVolumeReclaimPolicy
Request
Request parameters:
For the description about the Content-Type field, see Patch Request Method Operation Description.
Example request:
Content-Type: application/json-patch+json
[
{
"op": "add",
"path": "/spec/persistentVolumeReclaimPolicy",
"value": "Retain"
}
]
Response
Response parameters:
For the description about response parameters, see Table 2.
Example response:
{
"kind": "PersistentVolume",
"apiVersion": "v1",
"metadata": {
"name": "pv-test-03",
"namespace": "default",
"selfLink": "/api/v1/namespaces/default/persistentvolumes/pv-test-03",
"uid": "45eb3e76-9212-11e8-8cd0-fa163e082286",
"resourceVersion": "5690537",
"creationTimestamp": "2018-07-28T02:59:41Z",
"labels": {
"failure-domain.beta.kubernetes.io/region": "cn-north-4",
"failure-domain.beta.kubernetes.io/zone": "cn-north-4a",
"name": "pv-test-03"
},
"annotations": {
"volume.beta.kubernetes.io/storage-class": "sata",
"volume.beta.kubernetes.io/storage-provisioner": "flexvolume-huawei.com/fuxivol"
}
},
"spec": {
"capacity": {
"storage": "20Gi"
},
"hostPath": {
"path": "/home",
"type": ""
},
"accessModes": [
"ReadWriteMany"
],
"persistentVolumeReclaimPolicy": "Delete"
},
"status": {
"phase": "Available"
}
}
Status Code
Table 2 describes the status code of this API.
|
Status Code |
Description |
|---|---|
|
200 |
This operation succeeds, and a PersistentVolume resource object is returned. |
For the description about error status codes, see Status Code.
Last Article: Listing All PersistentVolumes
Next Article: PersistentVolumeClaim
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.