简体   繁体   English

Statefulset-是否可以在pod 0失败时跳过其创建并继续进行下一个的创建?

[英]Statefulset - Possible to Skip creation of pod 0 when it fails and proceed with the next one?

I currently do have a problem with the statefulset under the following condition: 目前,在以下情况下,我的statefulset确实有问题:

  • I have a percona SQL cluster running with persistent storage and 2 nodes 我有一个Percona SQL群集,该群集运行有持久性存储和2个节点
  • now i do force both pods to fail. 现在我确实迫使两个吊舱都失败了。
  • first i will force pod-0 to fail 首先,我将强制Pod-0失败
  • Afterwards i will force pod-1 to fail 之后,我将强制Pod-1失败
  • Now the cluster is not able to recover without manual interference and possible dataloss 现在,如果没有人工干预和可能的数据丢失,群集将无法恢复

Why: 为什么:

  • The statefulset is trying to bring pod-0 up first, however this one will not be brought online because of the following message: 有状态集正尝试首先启动pod-0,但是由于以下消息,该Pod-0将不会联机:

    [ERROR] WSREP: It may not be safe to bootstrap the cluster from this node. [错误] WSREP:从该节点引导群集可能并不安全。 It was not the last one to leave the cluster and may not contain all the updates. 它不是离开群集的最后一个,并且可能不包含所有更新。 To force cluster bootstrap with this node, edit the grastate.dat file manually and set safe_to_bootstrap to 1 要对此节点强制执行群集引导,请手动编辑grastate.dat文件,并将safe_to_bootstrap设置为1

What i could do alternatively, but what i dont really like: 我可以替代地做些什么,但是我真的不喜欢什么:

  • I could change ".spec.podManagementPolicy" to "Parallel" but this could lead to race conditions when forming the cluster. 我可以将“ .spec.podManagementPolicy”更改为“ Parallel”,但这在形成集群时可能导致争用情况。 Thus i would like to avoid that, i basically like the idea of starting the nodes one after another 因此,我想避免这种情况,我基本上喜欢一个接一个地启动节点的想法

What i would like to have: 我想拥有的是:

  • the possibility to have ".spec.podManagementPolicy":"OrderedReady" activated but with the possibility to adjust the order somehow 有可能激活“ .spec.podManagementPolicy”:“ OrderedReady”,但有可能以某种方式调整顺序
  • to be able to put specific pods into "inactive" mode so they are being ignored until i enable them again 能够将特定的广告连播设置为“非活动”模式,因此它们将被忽略,直到我再次启用它们为止

Is something like that available? 有这样的东西吗? Does someone have any other ideas? 有人还有其他想法吗?

Unfortunately, nothing like that is available in standard functions of Kubernetes. 不幸的是,在Kubernetes的标准功能中没有类似的东西可用。

I see only 2 options here: 我在这里只看到2个选项:

  1. Use InitContainers to somehow check the current state on relaunch. 使用InitContainers以某种方式检查重新启动时的当前状态。 That will allow you to run any code before the primary container is started so you can try to use a custom script in order to resolve the problem etc. 这将允许您在启动主容器之前运行任何代码,因此您可以尝试使用自定义脚本来解决问题等。

  2. Modify the database startup script to allow it to wait for some Environment Variable or any flag file and use PostStart hook to check the state before running a database. 修改数据库启动脚本,以使其等待某些环境变量或任何标志文件,并在运行数据库之前使用PostStart挂钩检查状态。

But in both options, you have to write your own logic of startup order. 但是在这两个选项中,您都必须编写自己的启动顺序逻辑。

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

相关问题 Kubectl 等待 statefulset 的一个 pod 准备就绪? - Kubectl wait for one pod of a statefulset to be READY? 在 statefulset 中重新启动 pod 时创建一个新卷 - Create a new volume when pod restart in a statefulset 是否可以将 StatefulSet 的 pod 分配给 Kubernetes 集群的特定节点? - Is it possible to assign a pod of StatefulSet to a specific node of a Kubernetes cluster? 仅从一个statefulset的一个pod中选择服务 - Service selection from only one pod of one statefulset Kubernetes-如何创建每个节点一个Pod的StatefulSet? - Kubernetes - How to create a StatefulSet with one Pod per Node? 当 kubernetes 中存在 pod 安全策略时,如何部署 statefulset - how to deploy a statefulset when a pod security policy is in place in kubernetes 在 statefulset 中跳过 pod 部署 - Skipping a pod deployment in statefulset StatefulSet 重新创建 pod,为什么? - StatefulSet recreates pod, why? 在 satrefulset 中运行的 pod 是否有可能获取在不同 statefulset 中运行的所有 pod 的主机名? - Is it possible for a pod running in a satrefulset to get the hostname of the all the pod running in different statefulset? 当 Kubernetes 活跃度探测失败时,是否可以指定 Pod 重启的延迟? - Is it possible to specify a delay for pod restart when Kubernetes liveness probe fails?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM