[英]Attach new azure disk volume per pod in Kubernetes deployment
I have a Kubernetes Deployment app with 3 replicas, which needs a 7GB storage for each replica, I want to be able to attach a new empty azureDisk storage to be mounted into each pod/replica created in this deployment.我有一个带有 3 个副本的 Kubernetes 部署应用程序,每个副本需要 7GB 存储空间,我希望能够附加一个新的空azureDisk存储空间,以安装到在此部署中创建的每个 pod/副本中。
Basically I have the following restrictions:基本上我有以下限制:
When using azureDisk, I need to use it with Access mode type ReadWriteOnce (as says in the docs ) and it will attach the only 1 pod to this disk, that's found, but, that only works if I have 1 pod, if I have more than 1 pod, I can't use the same claim... is there any way to dynamically ask for more storages like the one in the first claim?使用 azureDisk 时,我需要将它与 Access 模式类型 ReadWriteOnce 一起使用(如文档中所述),它会将唯一的 1 个 pod 附加到该磁盘,这是找到的,但是,只有当我有 1 个 pod 时才有效,如果我有超过 1 个 pod,我不能使用相同的声明...有没有办法像第一个声明中的那样动态请求更多存储空间?
NOTE 1: I know there is a volumeClaimTemplates, but that's only related to a Statefulset.注意 1:我知道有一个 volumeClaimTemplates,但这仅与 Statefulset 有关。
NOTE 2: I don't care if a pod restarts 100 times, and this in turn creates 100 PV which only 1 is used, that is fine.注意 2:我不在乎 pod 是否重新启动 100 次,这反过来又会创建 100 个 PV,而其中仅使用 1 个,这很好。
I'm not sure why you need to use a StatefulSet but the only I see to do this is to create your ownoperator for your application.我不确定您为什么需要使用 StatefulSet,但我看到的唯一做法是为您的应用程序创建自己的运算符。 The operator would have a controller that manages your pods similar to what a ReplicaSet does but with the exception that for every new pod that is instantiated a new PVC is created.操作员将拥有一个 controller 来管理您的 pod,这与ReplicaSet所做的类似,但不同之处在于,对于每个实例化的新 pod,都会创建一个新的 PVC。
It might just be better to figure out how to run your application in a StatefulSet and use VolumeClaimTemplates弄清楚如何在 StatefulSet 中运行应用程序并使用VolumeClaimTemplates可能会更好
✌️ ✌️
The main question is - Why?主要问题是——为什么? "if I have an application which doesn't have state, still I need a large volume for each pod" “如果我有一个没有 state 的应用程序,我仍然需要每个 pod 的大容量”
Looking at this explanation you should focus on StateFull application.查看这个解释,您应该关注 StateFull 应用程序。 From my point of view it looks like you are forcing to use Deployment instead of StateFullSet for StateFull application从我的角度来看,您似乎正在强制对StateFull 应用程序使用 Deployment 而不是 StateFullSet
In your example probably you need pv which support different access modes .在您的示例中,您可能需要支持不同访问模式的pv 。
The main problem you have experienced is that using pv with supported mode ReadWriteOnce you can bind at the same time only one pv by single node.您遇到的主要问题是,使用支持模式ReadWriteOnce的 pv,您只能通过单个节点同时绑定一个 pv。 So your pods in different nodes will not start due to failing volume mounting.因此,由于卷安装失败,您在不同节点中的 pod 将无法启动。 You can use this approach only for ReadOnlyMany/ReadWriteMany scenario.您只能将此方法用于ReadOnlyMany/ReadWriteMany方案。
Please refer to other providers which have different capabilities for access modes like: filestore(gcp) , AzureFile(azure) , Glusterfs, NFS请参考其他具有不同访问模式功能的提供商,例如: filestore(gcp) 、 AzureFile(azure) 、Glusterfs、NFS
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.