• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference 2.0
  4. Kubernetes API
  5. PersistentVolumeClaim
  6. Reading a Specified PersistentVolumeClaim

Reading a Specified PersistentVolumeClaim

Function

This API is used to read a PersistentVolumeClaim object under a specified Namespace.

URI

GET /api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}

Table 1 describes the parameters of this API.

Table 1 Parameter description

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:

Table 2 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

Table 11

Standard object's metadata.

spec

Table 4

Spec defines the desired characteristics of a volume requested by a pod author.

status

Table 3

Status represents the current information/status of a persistent volume claim. Read-only.

Table 3 Data structure of the status field

Parameter

Type

Description

accessModes

String Array

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.

Table 4 Data structure of the spec field

Parameter

Type

Description

volumeName

String

VolumeName is the binding reference to the PersistentVolume backing this claim.

accessModes

String Array

AccessModes contains the desired access modes the volume should have.

storageClassName

String

Name of the StorageClass required by the claim.

resources

Table 5

Resources represents the minimum resources the volume should have.

selector

Table 6

A label query over volumes to consider for binding.

Table 5 Data structure of the resources field

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.

Table 6 Data structure of the selector field

Parameter

Type

Description

matchExpressions

Table 7

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.

Table 7 Data structure of the matchExpressions field

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

String Array

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:

{
    "kind": "PersistentVolumeClaim",
    "apiVersion": "v1",
    "metadata": {
        "name": "db-mysql-1",
        "namespace": "default",
        "selfLink": "/api/v1/namespaces/default/persistentvolumeclaims/db-mysql-1",
        "uid": "7b7fb81b-20b2-11e7-9c83-fa163ec08232",
        "resourceVersion": "1435660",
        "creationTimestamp": "2017-04-14T01:34:20Z",
        "labels": {
            "app": "mysql"
        },
        "annotations": {
            "pv.kubernetes.io/bind-completed": "yes",
            "pv.kubernetes.io/bound-by-controller": "yes"
        }
    },
    "spec": {
        "accessModes": [
            "ReadWriteMany"
        ],
        "resources": {
            "requests": {
                "storage": "1Gi"
            }
        },
        "volumeName": "pv-test11"
    },
    "status": {
        "phase": "Bound",
        "accessModes": [
            "ReadWriteMany"
        ],
        "capacity": {
            "storage": "1Gi"
        }
    }
}

Status Code

Table 8 describes the status code of this API.

Table 8 Status code

Status Code

Description

200

This operation succeeds, and a PersistentVolumeClaim resource object is returned.

For the description about status codes, see Status Codes.