Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Pv and PVC storage of K8s notes

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

What are pv and pvc

1. PersistentVolume (PV) is a piece of network storage in the cluster that has been configured by the administrator. A resource in a cluster is like a node is a cluster resource. PV is a volume plug-in such as a volume, but has a life cycle independent of any single pod that uses PV. This API object captures the implementation details of the storage, that is, the NFS,iSCSI or cloud provider-specific storage system.

Types supported by PV

The commonly used types are

GCEPersistentDisk

AWSElasticBlockStore

AzureFile

AzureDisk

FC (Fibre Channel)

FlexVolume

Flocker

NFS

ISCSI

RBD (Ceph Block Device)

CephFS

Cinder (OpenStack block storage)

Glusterfs

VsphereVolume

Quobyte Volumes

HostPath

VMware Photon

Portworx Volumes

ScaleIO Volumes

2. Access mode of pv

ReadWriteOnce: read and write to a single node

ReadOnlyMany: multi-node read-only

ReadWriteMany: multi-node read and write. Only one mode can be used when mounting.

3. The recycling mode of pv

Retain-requires manual recycling by the administrator.

Recycle-clears the data in PV, which is equivalent to performing rm-rf / thevolume/*.

Delete-Delet

Create pv, which has been stored in nfs as an example

1. Install the nfs server

2. Create a storage path

3. Access directory authorization

Mkdir-p / data/test/v1

Echo "/ data/test/v1 * (rw,sync,no_root_squash)" > > / etc/exports

Exportfs-avr

Write yaml files

ApiVersion: v1kind: PersistentVolumemetadata: name: test01-pvspec: capacity: storage: 1Gi accessModes:-ReadWriteMany storageClassName: test01-pv persistentVolumeReclaimPolicy: Recycle nfs: path: / data/test/v1 server: 192.168.222.247

Kubectl create-f test01_pv.yaml

Binding of pvc

ApiVersion: v1kind: PersistentVolumeClaimmetadata: name: test01-pvc namespace: test01spec: storageClassName:-ReadWriteMany resources: requests: storage: 1Gi---apiVersion: v1kind: Podmetadata: name: myapp namespace: test01spec: containers:-name: myapp image: ikubernetes/myapp:v1 volumeMounts:-name: html mountPath: / usr/share/nginx/html volumes:-name: html persistentVolumeClaim: claimName: test01-pvc

Kubectl create-f test01_pod_pvc.yaml

View pvc and pod

Pv in bound state cannot be deleted directly

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report