在 Web 服务器的容器之间共享可写卷的理想方法是什么? [英] What would be an ideal way to share writable volume across containers for a web server?

查看:16
本文介绍了在 Web 服务器的容器之间共享可写卷的理想方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有问题的应用程序是 Wordpress,我需要为滚动部署/扩展目的创建副本.

The application in question is Wordpress, I need to create replicas for rolling deployment / scaling purposes.

如果使用持久卷(GCP 术语),似乎不能创建超过 1 个相同容器的实例:

It seem can't create more then 1 instance of the same container, if it uses a persistent volume (GCP term):

The Deployment "wordpress" is invalid: spec.template.spec.volumes[0].gcePersistentDisk.readOnly: Invalid value: false: must be true for replicated pods > 1; GCE PD can only be mounted on multiple machines if it is read-only

我有哪些选择?偶尔会有写入和多次读取.理想情况下,所有容器都可以写.我对使用网络文件系统犹豫不决,因为我不确定它们是否能为 Web 应用程序提供足够的性能(页面加载非常关键).

What are my options? There will be occasional writes and many reads. Ideally writable by all containers. I'm hesitant to use the network file systems as I'm not sure whether they'll provide sufficient performance for a web application (where page load is rather critical).

我的一个想法是,创建一个主容器(写和读权限)和从属容器(只读权限),这可以工作 - 我只需要弄清楚所需的 Kubernetes 配置.

One idea I have is, create a master container (write and read permission) and slaves (read only permission), this could work - I'll just need to figure out the Kubernetes configuration required.

推荐答案

https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistent-volumes 您可以看到一个表,其中包含允许 ReadWriteMany(您正在寻找的选项)的可能存储类.

In https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistent-volumes you can see a table with the possible storage classes that allow ReadWriteMany (the option you are looking for).

  • AzureFile(不适合使用 GCP)
  • CephFS
  • Glusterfs
  • Quobyte
  • NFS
  • PortworxVolume

我尝试过的一种是 NFS.我没有问题,但我想你也应该考虑潜在的性能问题.但是,如果写入是偶尔的,那应该不是什么大问题.

The one that I've tried is that of NFS. I had no issues with it, but I guess you should also consider potential performance issues. However, if the writes are to be occassional, it shouldn't be much of an issue.

这篇关于在 Web 服务器的容器之间共享可写卷的理想方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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