...
These Kubernetes components can be finely customized thanks to a number of parameters. We briefly present the theoretical aspects concerning their personalization.
Persistent Volume
The following parameters can be managed only if the static mode is chosen, since in the dynamic case the PVs are generated on the basis of the SC and the PVCs. The aspects concerning the PV are:
- Capacity. A PV will have a specific storage capacity. This is set using the PV's capacity attribute. An example list of accepted values are 500K, 100M, 5G, 800Ki, 350Mi, 1Ti. The letter "i" accompanying the various SI prefixes indicates numbers on a binary basis, rather than a decimal basis (more details here).
- Volume mode. Kubernetes supports
Filesystem(default) andBlockvolume modes. In the first case, a volume is mounted into Pods into a directory. In the second, volume volume is presented into a Pod as a block device, without any filesystem on it. This This mode is useful to provide a Pod the fastest possible way to access a volume, without any filesystem layer between the Pod and the volume. - Access Mode. The ways of accessing the volume are shown below. Not all providers, however, support the 3 modes listed.
ReadWriteOnce(RWO): the volume can be mounted as read-write by a single node;- ReadOnlyMany
ReadOnlyMany(ROX): the volume can be mounted read-only by many nodes; ReadWriteMany(RWX): the volume can be mounted as read-write by many nodes.
- Class. A PV can have a class, which is specified by setting the storageClassNameattribute to the name of a SC. A PV of a particular class can only be bound to PVCs requesting that class. A PV with no storageClassName has no class and can only be bound to PVCs that request no particular class. In the static case, therefore, the class merely has the function of a label.
- Reclaim Policy. Current reclaim policies are listed below. As in the case of access mode, policy support depends on the provider used.
- Retain: manual reclamation;
- Recycle: basic scrub (
rm -rf /thevolume/*); - Delete: associated storage asset is deleted.
- Mount Option. A Kubernetes administrator can specify additional mount options for when a PV is mounted on a node, using the
mountOptionsattribute. Mount options are not validated, so mount will simply fail if one is invalid. Again, not all persistent volume types support mount options. - Node Affinity. Kubernetes offers us the possibility to create a sub-selection of nodes, from which the volume can be accessed. Pods that use a PV will only be scheduled to nodes that are selected by the node affinity.
- Phase. Even if it does not represent a parameter, we conclude the part on the PV with a picture regarding the possible status it can assume.
- Available: a free resource that is not yet bound to a claim;
- Bound: the volume is bound to a claim;
- Released: the claim has been deleted, but the resource is not yet reclaimed by the cluster;
- Failed: the volume has failed its automatic reclamation;
Persistent Volume Claim
Now let's move on to the component that deals with claiming pieces of storage. PVC can be used both in static and dynamic mode, but it was mainly born to be used on the frontend side in dynamic mode. The aspects concerning the PVC are:
- Capacity. Claims, like Pods, can request specific quantities of a resource. In this case, the request is for storage and use the same convention as PV.
- Volume mode. Same conventions as PV.
- Access Mode. Same conventions as PV.