AWS 上具有 ReadWriteMany 的 Kubernetes PVC [英] Kubernetes PVC with ReadWriteMany on AWS

查看:30
本文介绍了AWS 上具有 ReadWriteMany 的 Kubernetes PVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 AWS 上设置 PVC,我需要 ReadWriteMany 作为访问模式.不幸的是,EBS 仅支持 ReadWriteOnce.

I want to setup a PVC on AWS, where I need ReadWriteMany as access mode. Unfortunately, EBS only supports ReadWriteOnce.

我该如何解决这个问题?

How could I solve this?

  • 我已经看到 AWS EFS 有一个支持 ReadWriteMany 的测试版提供商,但如前所述,这仍然是测试版,它的安装看起来有些不稳定.
  • 我可以使用节点关联性将所有依赖 EBS 卷的 Pod 强制到单个节点,并使用 ReadWriteOnce,但这会限制可扩展性.
  • I have seen that there is a beta provider for AWS EFS which supports ReadWriteMany, but as said, this is still beta, and its installation looks somewhat flaky.
  • I could use node affinity to force all pods that rely on the EBS volume to a single node, and stay with ReadWriteOnce, but this limits scalability.

还有其他方法可以解决这个问题吗?基本上,我需要的是一种以持久方式存储数据的方法,以便在相互独立的 Pod 之间共享数据.

Are there any other ways of how to solve this? Basically, what I need is a way to store data in a persistent way to share it across pods that are independent of each other.

推荐答案

使用 EFS 而不自动配置

EFS 配置程序可能是测试版,但 EFS 本身不是.由于 EFS 卷可以通过 NFS 挂载,您可以简单地手动创建一个带有 NFS 卷源的 PersistentVolume —— 假设自动配置对您来说不是硬性要求:

Using EFS without automatic provisioning

The EFS provisioner may be beta, but EFS itself is not. Since EFS volumes can be mounted via NFS, you can simply create a PersistentVolume with a NFS volume source manually -- assuming that automatic provisioning is not a hard requirement on your side:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: my-efs-volume
spec:
  capacity:
    storage: 100Gi # Doesn't really matter, as EFS does not enforce it anyway
  volumeMode: Filesystem
  accessModes:
    - ReadWriteMany
  mountOptions:
    - hard
    - nfsvers=4.1
    - rsize=1048576
    - wsize=1048576
    - timeo=600
    - retrans=2
  nfs:
    path: /
    server: fs-XXXXXXXX.efs.eu-central-1.amazonaws.com

然后,您可以使用 PersistentVolumeClaim 声明该卷,并像往常一样在一个 Pod(或多个 Pod)中使用它.

You can then claim this volume using a PersistentVolumeClaim and use it in a Pod (or multiple Pods) as usual.

如果自动配置对您来说是一个硬性要求,您可能会考虑一些替代解决方案:您可以在集群上部署多个分布式文件系统,它们在 Kubernetes 之上提供 ReadWriteMany 存储和/或 AWS.例如,您可以查看 Rook(它基本上是 Ceph 的 Kubernetes 运算符).它也正式仍处于预发布阶段,但我已经使用过它并且运行得相当好.还有 GlusterFS operator,它似乎已经有一些稳定版本.

If automatic provisioning is a hard requirement for you, there are alternative solutions you might look at: There are several distributed filesystems that you can roll out on yourcluster that offer ReadWriteMany storage on top of Kubernetes and/or AWS. For example, you might take a look at Rook (which is basically a Kubernetes operator for Ceph). It's also officially still in a pre-release phase, but I've already worked with it a bit and it runs reasonably well. There's also the GlusterFS operator, which already seems to have a few stable releases.

这篇关于AWS 上具有 ReadWriteMany 的 Kubernetes PVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆