简体   繁体   English

使用每个 az 共享卷缩放有状态集

[英]scale stateful set with shared volume per az

I would like to scale a kubernetes stateful set in EKS which serves static data.我想在 EKS 中扩展一个 kubernetes 有状态集,它提供 static 数据。 The data should be shared where possible, which means by availability zone.应尽可能共享数据,这意味着通过可用区。

Can I specify a volume claim template to make this possible?我可以指定一个批量声明模板来实现这一点吗? Or is there another mechanism?还是有其他机制?

I also need to initialize the volume (in an init-container) when the first node joins.当第一个节点加入时,我还需要初始化卷(在 init-container 中)。 Do I need to provide some external locking mechanism rather than just checking if volume is empty?我是否需要提供一些外部锁定机制而不仅仅是检查卷是否为空?

If you want your pods to share static data, then you can:如果您希望您的 pod 共享 static 数据,那么您可以:

  1. Put the data into the Persistent Volume将数据放入 Persistent Volume
  2. Mount the same volume into the Pods (with ReadOnlyMany )将相同的卷挂载到 Pod 中(使用ReadOnlyMany

A few comments:几点评论:

  • Here you can find the list of volumes, so you can choose the one that fits your needs在这里您可以找到卷列表,以便您选择适合您需要的卷
  • Since every pod serves the same data, you may use Deployment instead of StatefulSet, StatefulSets are when each of your pod is different由于每个 pod 提供相同的数据,您可以使用 Deployment 而不是 StatefulSet,StatefulSets 是当您的每个 pod 不同时
  • If you need the first pod to initialize the data, then you can either use initContainer (then use ReadWriteMany instead of ReadOnlyMany ).如果您需要第一个 pod 来初始化数据,那么您可以使用initContainer (然后使用ReadWriteMany而不是ReadOnlyMany )。 Depending on what you try to do exactly, but maybe you can first initialize the data and then start your Deployment (and Pods), then you'd not need to lock anything取决于您尝试做什么,但也许您可以先初始化数据,然后启动您的部署(和 Pod),然后您就不需要锁定任何东西

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM