在AWS上使用ReadWriteMany的Kubernetes PVC [英] Kubernetes PVC with ReadWriteMany on AWS

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

问题描述

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

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

我该如何解决?

  • 我已经看到有一个AWS EFS的beta提供程序支持ReadWriteMany,但是如上所述,它仍然是beta,其安装看起来有些不稳定.
  • 我可以使用节点亲和力将所有依赖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设置程序可以是beta,但EFS本身不是.由于可以通过NFS挂载EFS卷,因此您可以简单地手动创建带有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和/或AWS上提供ReadWriteMany存储.例如,您可以查看 Rook (它基本上是Ceph的Kubernetes运算符).它也仍然正式处于预发布阶段,但是我已经对其进行了一些操作,并且运行良好. 还有 GlusterFS运算符,它似乎已经有一些稳定的发行版.

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天全站免登陆