Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is Kubernetes's PVC?

Shulou Source: shulou.com Published: 2022-06-01 10:57:46 11月11日 Update

This article mainly explains "what is the PVC of Kubernetes". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the PVC of Kubernetes".

PVC is used for the declaration of PV.

Life cycle

Pending: waiting status, not yet bound to PV

Bound: binding status, already bound to PV

Lost: lost status, lost binding relationship with PV

Parameter accessModes (access mode)

This field, PVC, is the same as PV. You can also set the access mode and describe the access permissions of the application to the storage resources.

VolumeMode (Storage Volume Mode)

This field, PVC is the same as PV, describes the PV storage volume mode you want to use, which can be configured as file system and block devices.

Resources (Resource request)

This field is used to describe requests for storage resources. Currently, you can only set requests.storage, that is, the setting of storage space.

StorageClassName (name of the bound StorageClass, that is, storage category)

This field is used to set the backend storage category (that is, bind StorageClass) to reduce dependence on backend storage feature details. There are two situations:

If you set this field to a StorageClass, only PV with the same Class set will be selected and bound to PVC.

If you set this field to empty storageClassName= "", you will not set Class. This depends on whether the system enables the admission controller named DefaultStorageClass:

DefaultStorageClass is not started: PV with no Class set will be selected for matching and binding.

Enable DefaultStorageClass: the administrator defines the default StorageClass, and the system creates a PV using the back-end storage of the default StorageClass and automatically binds to the PVC. The specific way to set this is to add an annotation "storageclass.kubernetes.io/is-default-class=true" to the definition of StorageClass. It is important to note that only one default StorageClass can be defined.

Selector (selection criteria)

This field can filter all kinds of PV that already exist in the system, and select the most suitable PV to bind according to the filter conditions. There are two fields below:

MatchLabels:PV must have this tag value

MatchExpressions: specifies the tag selector list through key-value pairs and operators, including: In, Notln, Exists, and DoesNotExist

If both fields are set, all the conditions must be met to complete the match.

Finally, it is important to note that Pod, PV, and PVC must all work in the same namespace.

In addition, if dynamic storage management is used, that is, the PV is not defined in advance, but only handed over to the system through StorageClass to automatically complete the dynamic creation of PV, then the selector set by PVC is invalid. If the user deletes the PVC, the PV bound to it (the default recycling policy is Delete) will also be deleted. You can manually change the Delete policy to Retain after the binding is successful.

Thank you for your reading, the above is the content of "what is the PVC of Kubernetes". After the study of this article, I believe you have a deeper understanding of what the PVC of Kubernetes is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Storage field pattern system condition same state resource learning selection two function content dynamic namely situation operator label space category Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MySQL Shulou Information Shulou Technology NVidia