Kubernetes Chapter XI PV / PVC / StorageClass

PV/PVC/StorageClass

Storage management is a significant issue management calculations. The PersistentVolumesubsystem provides an API for users and administrators, provide detailed information on how to abstract stored according to consumption. To this end, we have introduced two new API resources: PersistentVolumeand PersistentVolumeClaim.

PersistentVolume(the PV) is stored in a cluster, or by an administrator using configuration storage class dynamic configuration . It is a cluster of resources, like a cluster node is a resource. PV is the capacity of the widget, such as Volumes, but its lifetime is independent of any single pod use of PV. This object capture API implementation details stored, the storage system including NFS, iSCSI, or specific cloud provider.

A PersistentVolumeClaim(PVC) is stored by the user request. It is similar to a pods. Pod node resource consumption, PVC PV resource consumption. Pod may request a particular level of resources (CPU and memory). Statement can request a particular size and access mode (for example, a read / write or read-only times).

The final realization of persistent data

 

Using NFS test

[@ Kube the root yum .repos.d] # yum  the install -Y NFS-safe locking utils // Installation 
Loaded plugins: fastestmirror 
Loading Mirror SPEEDS cached from the hostfile 
Resolving the Dependencies 
....... 

[the root @ Kube Data] # CAT / etc / Exports // edit the configuration file
 / nfs / the Data 10.2 . 61.0 / 24- (rw, no_root_squash, Sync ) 
[root @ Kube the Data] # 
# start the service 
systemctl restart the rpcbind && systemctl enable the rpcbind 
systemctl restart nfs && systemctl enable nfs 

// The client is installed by yum install -y nfs-utils

 

 

nfs create multiple mount points

[root@kube data]# exportfs
/nfs/data/v1      10.2.61.0/24
/nfs/data/v2      10.2.61.0/24
/nfs/data/v3      10.2.61.0/24
/nfs/data/v4      10.2.61.0/24
/nfs/data/v5      10.2.61.0/24
/nfs/data/v6      10.2.61.0/24
/nfs/data/v7      10.2.61.0/24
/nfs/data/v8      10.2.61.0/24
/nfs/data/v9      10.2.61.0/24
[root@kube data]# 
[root@kube data]# systemctl restart rpcbind && systemctl restart nfs
[root@kube data]# 

 

 

Creating PV

[root@kube pv-pvc]# cat p1.yaml 
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv0001
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Recycle
  storageClassName: slow
  nfs:
    path: /nfs/data/v1
    server: 10.2.61.21
[root@kube pv-pvc]# 
[root@kube pv-pvc]# kubectl get pv
NAME     CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM   STORAGECLASS   REASON   AGE
pv0001   5Gi        RWO            Recycle          Available           slow                    20s
[root@kube pv-pvc]# 

 

Guess you like

Origin www.cnblogs.com/zy09/p/11419779.html