创建PV时使用VOLUME ID有什么用?
What is use of using VOLUME ID while creating PV?
观察到在 AWS EKS 中创建 PV 和 PVC 的两种语法。
1)Using vol Id while creating both PV & PVC (Create volume manually and using that id)
2)不使用vol Id(PV的动态配置)
示例 1:
- apiVersion: "v1"
kind: "PersistentVolume"
metadata:
name: "pv-aws"
spec:
capacity:
storage: 10G
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: gp2
awsElasticBlockStore:
volumeID: vol-xxxxxxxx
fsType: ext4
在这种情况下,我手动创建卷并使用它创建 PV 和 PVC
示例 2:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc1
spec:
accessModes:
- ReadWriteOnce
storageClassName: gp2
resources:
requests:
storage: 20Gi
在这种情况下,只需在后端 (AWS) 和 PV 中创建 PVC 即可。
有什么区别,在什么场景下使用?优缺点?
这应该根据您的要求。静态配置通常不可扩展。您必须在 k8s 上下文之外创建卷。安装现有卷在灾难恢复场景中很有用。
使用 Storage classes, or dynamic provisioning, is generally preferred because of the convenience. You can create roles and resource quotas 来控制和限制存储使用并减少操作开销。
观察到在 AWS EKS 中创建 PV 和 PVC 的两种语法。
1)Using vol Id while creating both PV & PVC (Create volume manually and using that id) 2)不使用vol Id(PV的动态配置)
示例 1:
- apiVersion: "v1"
kind: "PersistentVolume"
metadata:
name: "pv-aws"
spec:
capacity:
storage: 10G
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: gp2
awsElasticBlockStore:
volumeID: vol-xxxxxxxx
fsType: ext4
在这种情况下,我手动创建卷并使用它创建 PV 和 PVC
示例 2:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvc1
spec:
accessModes:
- ReadWriteOnce
storageClassName: gp2
resources:
requests:
storage: 20Gi
在这种情况下,只需在后端 (AWS) 和 PV 中创建 PVC 即可。
有什么区别,在什么场景下使用?优缺点?
这应该根据您的要求。静态配置通常不可扩展。您必须在 k8s 上下文之外创建卷。安装现有卷在灾难恢复场景中很有用。
使用 Storage classes, or dynamic provisioning, is generally preferred because of the convenience. You can create roles and resource quotas 来控制和限制存储使用并减少操作开销。