简体   繁体   English

如何在 Kubernetes 集群中扩展 Wordpress - 使用多个 pod 副本, - 访问单个 PVC(持久性文件存储)

[英]How can you scale Wordpress in Kubernetes cluster - using multiple pod replicas, - accessing a single PVC (persistent file storage)

I'm learning Kubernetes, and trying to setup a cluster that could handle a single Wordpress site with high traffic.我正在学习 Kubernetes,并尝试设置一个可以处理单个高流量 Wordpress 站点的集群。 From reading multiple examples online from both Google Cloud and Kubernetes.io - they all set the "accessMode" - "readWriteOnce" when creating the PVCs.从 Google Cloud 和 Kubernetes.io 在线阅读多个示例 - 它们在创建 PVC 时都设置了“accessMode”-“readWriteOnce”。

Does this mean if I scaled the Wordpress Deployment to use multiple replicas, they all use the same single PVC to store persistent data - read/write data.这是否意味着如果我扩展 Wordpress 部署以使用多个副本,它们都使用相同的单个 PVC 来存储持久数据 - 读/写数据。 (Just like they use the single DB instance?) (就像他们使用单个数据库实例一样?)

The google example here only uses a single-replica, single-db instance - https://cloud.google.com/kubernetes-engine/docs/tutorials/persistent-disk此处的 google 示例仅使用单副本、单数据库实例 - https://cloud.google.com/kubernetes-engine/docs/tutorials/persistent-disk

My question is how do you handle persistent storage on a multiple-replica instance?我的问题是如何处理多副本实例上的持久存储?

ReadWriteOnce means all replicas will use the same volume and therefore they will all run on one node. ReadWriteOnce 意味着所有副本将使用相同的卷,因此它们都将在一个节点上运行。 This can be suboptimal.这可能是次优的。

You can set up ReadWriteMany volume (NFS, GlusterFS, CephFS and others) storage class that will allow multiple nodes to mount one volume.您可以设置 ReadWriteMany 卷(NFS、GlusterFS、CephFS 等)存储类,允许多个节点挂载一个卷。

Alternatively you can run your application as StatefulSet with volumeClaimTemplate which ensures that each replica will mount its own ReadWriteOnce volume.或者,您可以将应用程序作为 StatefulSet 与 volumeClaimTemplate 一起运行,以确保每个副本都将挂载自己的 ReadWriteOnce 卷。

If on AWS (and therefore blocked by the limitation of EBS volumes only mountable on a single instance at a time), another option here is setting up the Pod Affinity to schedule on the same node.如果在 AWS 上(因此被 EBS 卷一次只能安装在一个实例上的限制所阻止),这里的另一个选项是设置 Pod Affinity 以在同一节点上进行调度。 Not ideal from an HA standpoint, but it is an option.从 HA 的角度来看并不理想,但它是一种选择。

If after setting that up you start running into any wonky issues (eg unable to login to the admin, redirect loops, disappearing media), I wrote a guide on some of the more common issues people run into when running Wordpress on Kubernetes, might be worth having a look!若设置为高达你开始运行到任何靠不住的问题(例如无法登录到管理,重定向循环,消失的媒体)之后,我写了一个引导上的一些人运行更常见的问题上Kubernetes运行WordPress的时候进入,可能是值得一看!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 kubernetes 集群中为 Persistent Volume provisioner 提供支持? - How to provide support for Persistent Volume provisioner within an kubernetes cluster? 无法为具有持久数据工作的wordpress和mysql创建kubernetes示例 - Can't make kubernetes example for wordpress & mysql with persistent data work 在 Kubernetes 中部署 Wordpress 的存储策略 - Storage strategy to deploy Wordpress in Kubernetes 如何在单个wordpress页面上添加多个元素 - How can i add multiple elements on a single wordpress page 如何在 kubernetes 中部署多个 wordpress? - How can I deploy multi wordpress in kubernetes? 如何覆盖meta deta以在单个Wordpress帖子上创建多个唯一的共享链接? - How do you override the meta deta to create multiple unique share links on a single Wordpress post? 我如何直接将特定产品添加到Wordpress中的持久购物车 - How can i directly add particular product to persistent cart in wordpress wordpress // pods cms-如何为我的pod指定自定义模板文件? - wordpress//pods cms - how to specify a custom template file to my pod? 如何在Wordpress中为单个用户分配多个角色 - How to assign Multiple roles to a single user in wordpress Wordpress将多个hreflang转换为单个URL,怎么办? - Wordpress multiple hreflang to single url, HOW?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM