【发布时间】:2021-02-22 00:19:23
【问题描述】:
我正在尝试将我的部署从 Minikube 平台迁移到 AWS 中的 KOPS 集群。 在我的部署中,我有多个共享同一个 pvc(持久卷声明)的 pod。
因此,当这些 pod 在不同节点(不同实例)上运行时,从 KOPS 集群中的不同 pod 访问 ebs pvc 会出现问题。例如 - 我有 3 个 pod 和 2 个节点。假设 pod1 在 node1 上运行,而 pod2&pod3 在 node2 上运行。 pod1 连接 ebs pvc 后,pod2&pod3 将无法连接 ebs pvc。
如何让 ebs pvc 可以从 AWS 的 kops 集群中不同节点上运行的不同 pod 访问?
volume.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: media-volume
spec:
storageClassName: gp2-manual
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
awsElasticBlockStore:
fsType: ext4
volumeID: <volumeID>
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: media-volume-claim
spec:
storageClassName: gp2-manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
【问题讨论】:
-
您能否尝试将访问模式从
ReadWriteOnce更改为ReadWriteMany?如documentationReadWriteOnce -- the volume can be mounted as read-write by a single node中所述。 -
EBS pvc 无法使用 ReadWriteMany 访问模式,因为 EBS 仅允许 ReadWriteOnce 访问模式。目前,我正在使用 EFS,但我的老板更喜欢使用 EBS 而不是 EFS。
标签: amazon-web-services kubernetes kops