Reading a Specified PersistentVolumeClaim
Function
This API is used to read a PersistentVolumeClaim in a specified namespace.
URI
GET /api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}
Table 1 describes the parameters of this API.
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
name |
Yes |
Name of the PersistentVolumeClaim. |
|
namespace |
Yes |
Object name and auth scope, such as for teams and projects. |
|
pretty |
No |
If 'true', then the output is pretty printed. |
|
exact |
No |
Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'. |
|
export |
No |
Should this value be exported. Export strips fields that a user cannot specify. |
Request
N/A
Response
Response parameters:
|
Parameter |
Type |
Description |
|---|---|---|
|
apiVersion |
String |
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. |
|
kind |
String |
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. |
|
metadata |
metadata object |
Standard object's metadata. |
|
spec |
spec object |
Spec defines the desired characteristics of a volume requested by a pod author. |
|
status |
status object |
Status represents the current information/status of a persistent volume claim. Read-only. |
|
Parameter |
Type |
Description |
|---|---|---|
|
accessModes |
Array of strings |
AccessModes contains the actual access modes the volume backing the PVC has. |
|
capacity |
Object |
Represents the actual resources of the underlying volume. |
|
phase |
String |
Phase represents the current phase of PersistentVolumeClaim. |
|
Parameter |
Type |
Description |
|---|---|---|
|
volumeName |
String |
VolumeName is the binding reference to the PersistentVolume backing this claim. |
|
accessModes |
Array of strings |
AccessModes contains the desired access modes the volume should have. |
|
storageClassName |
String |
Name of the StorageClass required by the claim. |
|
resources |
resources object |
Resources represents the minimum resources the volume should have. |
|
selector |
selector object |
A label query over volumes to consider for binding. |
|
Parameter |
Type |
Description |
|---|---|---|
|
limits |
Object |
Limits describes the maximum amount of compute resources allowed.
NOTE:
Parameter limits is invalid. |
|
requests |
Object |
Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value.
NOTE:
Except parameter storage, the other parameters (such as CPU and memory) are invalid. |
|
Parameter |
Type |
Description |
|---|---|---|
|
matchExpressions |
matchExpressions object |
MatchExpressions is a list of label selector requirements. The requirements are ANDed. |
|
matchLabels |
Object |
MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. |
|
Parameter |
Type |
Description |
|---|---|---|
|
key |
String |
Key is the label key that the selector applies to. |
|
operator |
String |
Operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. |
|
values |
Array of strings |
Values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. |
Example response:
- The following is an example of a cluster of 1.15 or later:
{ "kind":"PersistentVolumeClaim", "apiVersion":"v1", "metadata":{ "name":"cce-evs-k6m131jj-i1px", "namespace":"default", "selfLink":"/api/v1/namespaces/default/persistentvolumeclaims/cce-evs-k6m131jj-i1px", "uid":"d34f6a93-9eba-4a33-9320-8fa4addd3753", "resourceVersion":"2286592", "creationTimestamp":"2020-02-14T10:27:43Z", "labels":{ "failure-domain.beta.kubernetes.io/region":"cn-north-5", "failure-domain.beta.kubernetes.io/zone":"cn-north-5a" }, "annotations":{ "everest.io/disk-volume-type":"SATA", "pv.kubernetes.io/bind-completed":"yes", "pv.kubernetes.io/bound-by-controller":"yes", "volume.beta.kubernetes.io/storage-provisioner":"everest-csi-provisioner" }, "finalizers":[ "kubernetes.io/pvc-protection" ] }, "spec":{ "accessModes":[ "ReadWriteOnce" ], "resources":{ "requests":{ "storage":"10Gi" } }, "volumeName":"pvc-d34f6a93-9eba-4a33-9320-8fa4addd3753", "storageClassName":"csi-disk", "volumeMode":"Filesystem" }, "status":{ "phase":"Bound", "accessModes":[ "ReadWriteOnce" ], "capacity":{ "storage":"10Gi" } } } - Example for clusters of version 1.13 or earlier:
{ "kind": "PersistentVolumeClaim", "apiVersion": "v1", "metadata": { "name": "db-mysql", "namespace": "default", "selfLink": "/api/v1/namespaces/default/persistentvolumeclaims/db-mysql", "uid": "ac34af93-8cdd-11e8-8ee0-fa163e49263c", "resourceVersion": "4197709", "creationTimestamp": "2018-07-21T12:00:33Z", "labels": { "failure-domain.beta.kubernetes.io/region": "cn-north-4", "failure-domain.beta.kubernetes.io/zone": "cn-north-4a" }, "annotations": { "pv.kubernetes.io/bind-completed": "yes", "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": { "accessModes": [ "ReadWriteMany" ], "resources": { "requests": { "storage": "10Gi" } }, "volumeName": "pvc-ac34af93-8cdd-11e8-8ee0-fa163e49263c", "volumeNamespace": "default" }, "status": { "phase": "Bound", "accessModes": [ "ReadWriteMany" ], "capacity": { "storage": "10Gi" } } }
Status Code
Table 8 describes the status code of this API.
|
Status Code |
Description |
|---|---|
|
200 |
This operation succeeds, and a PersistentVolumeClaim resource object is returned. |
For the description about error status codes, see Status Code.
Last Article: Deleting All PersistentVolumeClaims
Next Article: Replacing a Specified PersistentVolumeClaim
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.