获取指定的PersistentVolumeClaim
功能介绍
该API用于获取指定Namespace下的PersistentVolumeClaim对象。
URI
GET /api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}
表1 描述该API的参数。
参数 |
是否必选 |
描述 |
---|---|---|
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 can not specify. |
请求消息
N/A
响应消息
响应参数:
参数 |
参数类型 |
描述 |
---|---|---|
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. |
参数 |
参数类型 |
描述 |
---|---|---|
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. |
参数 |
参数类型 |
描述 |
---|---|---|
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. |
参数 |
参数类型 |
描述 |
---|---|---|
limits |
Object |
Limits describes the maximum amount of compute resources allowed. 说明:
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. 说明:
Except parameter storage, the other parameters (such as CPU and memory) are invalid. |
参数 |
参数类型 |
描述 |
---|---|---|
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. |
参数 |
参数类型 |
描述 |
---|---|---|
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. |
响应示例:
- 1.15及以上版本集群,示例如下:
{ "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":"SAS", "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" } } }
- 1.13及之前集群版本示例:
{ "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": "SAS", "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" } } }
