Replacing a Specified PersistentVolume
Function
This API is used to replace a specified PersistentVolume.
The following fields can be updated:
- metadata.labels
- metadata.generateName
- spec.accessModes
- spec.capacity
- spec.persistentVolumeReclaimPolicy
Request
Request parameters:
For the description about request parameters, see Table 2.
Example request:
{
"apiVersion": "v1",
"kind": "PersistentVolume",
"metadata": {
"labels": {
"failure-domain.beta.kubernetes.io/region": "cn-north-4",
"failure-domain.beta.kubernetes.io/zone": "cn-north-4a",
"name": "pv-test-03"
},
"name": "pv-test-02",
"annotations": {
"volume.beta.kubernetes.io/storage-class": "sata",
"volume.beta.kubernetes.io/storage-provisioner": "flexvolume-huawei.com/fuxivol"
},
"generateName": "pv-demo"
},
"spec": {
"accessModes": [
"ReadWriteMany"
],
"capacity": {
"storage": "11Gi"
},
"hostPath": {
"path": "/home"
},
"persistentVolumeReclaimPolicy": "Delete"
}
}
Response
Response parameters:
For the description about response parameters, see Table 2.
Example response:
{
"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": "5673741",
"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": {
"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"
],
"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: Reading a Specified PersistentVolume
Next Article: Replacing the Status of a Specified PersistentVolume
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.