简体   繁体   English

Kubernetes:并行更新所有 pod

[英]Kubernetes: Update all pods in parallel

Is there any way to perform an update action on all pods simultaneously?有没有办法同时对所有 pod 执行更新操作?

We have a process running in kubernetes as a stateful set where we want to update all the pods at the same time.我们有一个在 kubernetes 中运行的进程作为有状态集,我们希望同时更新所有 pod。 We cannot seem to find a configuration for that.我们似乎无法为此找到配置。 I am aware of rollingUpdate , which only updates one pod at a time.我知道rollingUpdate ,它一次只更新一个 pod。

This is what we have currently这是我们目前拥有的

  updateStrategy:
    rollingUpdate:
      partition: 2
    type: RollingUpdate

I also tried with maxUnavailable , but still did not work.我也尝试使用maxUnavailable ,但仍然没有用。 Is there any other hack to get this done?有没有其他技巧可以完成这项工作?

There is no native alternative for updating all pods simultaneously when using Statefulsets.使用 Statefulsets 时,没有本地替代方法可以同时更新所有 pod。

The closest thing to it is to use the Parallel Pod Management policy , but it only affects the behavior for scaling operations (including initial setup) and doesn't work for updates.最接近它的是使用Parallel Pod Management 策略,但它只影响扩展操作的行为(包括初始设置),不适用于更新。


Although, the OpenKruise project has an extended component suite that enables Advanced StatefulSet to update workflow.虽然,OpenKruise 项目有一个扩展的组件套件,它使Advanced StatefulSet能够更新工作流。

Here is a minimal working example that will upgrade all pods at once :这是一个最小的工作示例,它将一次升级所有 pod

apiVersion: apps.kruise.io/v1beta1
kind: StatefulSet
metadata:
  name: sample
spec:
  replicas: 5
  serviceName: fake-service
  selector:
    matchLabels:
      app: sample
  template:
    metadata:
      labels:
        app: sample
    spec:
      readinessGates:
      - conditionType: InPlaceUpdateReady
      containers:
      - name: main
        image: nginx:alpine
  podManagementPolicy: Parallel
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 100%

Note this will certainly cause downtime , but you can adjust to something like maxUnavailable: 50% to make it more resilient.请注意,这肯定会导致downtime ,但您可以调整为maxUnavailable: 50%以使其更具弹性。

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

相关问题 python中的并行查询,在kubernetes中有一个文件和几个pod - Parallel queries in python, with a file and several pods in kubernetes Kubernetes - 在所有 pod 上生成文件 - Kubernetes - Generate files on all the pods 删除所有 kube.netes 命名空间中的所有 pod 的命令 - Command to delete all pods in all kubernetes namespaces 如果在 Kubernetes 中重新启动所有 pod 而无需重新启动客户端应用程序,Cassandra 驱动程序如何更新contactPoints? - How does Cassandra driver update contactPoints if all pods are restarted in Kubernetes without restarting the client application? 在kubernetes中,如何更新Pod以使用更新的configmap - in kubernetes, how to update pods to use updated configmap kubernetes 部署在 pod 之间等待滚动更新 - kubernetes deployment wait between pods on rolling update 如何更新在 kubernetes 中运行的一组 pod? - How to update a set of pods running in kubernetes? Kubernetes pod 无法更新基于 debian 的存储库 - Kubernetes pods not able to update repositories of debian based 如何为 kubernetes pod 分配亲和力,以便在所有广告中分发 pod? - how to assign affinity to kubernetes pods for distributing the pods across all ads? Kubernetes:列出所有 pod 及其节点 - Kubernetes: list all pods and its nodes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM