zoukankan      html  css  js  c++  java
  • 转载:k8s更新策略


    https://kubernetes.io/zh/docs/concepts/workloads/controllers/deployment/

    Strategy
    .spec.strategy specifies the strategy used to replace old Pods by new ones.
    .spec.strategy.type can be “Recreate” or “RollingUpdate”. “RollingUpdate” is the default value.

    Recreate Deployment
    All existing Pods are killed before new ones are created when .spec.strategy.type==Recreate.

    Rolling Update Deployment
    The Deployment updates Pods in a rolling update fashion when .spec.strategy.type==RollingUpdate.
    You can specify maxUnavailable and maxSurge to control the rolling update process.

    Max Unavailable
    .spec.strategy.rollingUpdate.maxUnavailable is an optional field that specifies
    the maximum number of Pods that can be unavailable during the update process.
    The value can be an absolute number (for example, 5) or a percentage of desired Pods
    (for example, 10%). The absolute number is calculated from percentage by rounding down.
    The value cannot be 0 if .spec.strategy.rollingUpdate.maxSurge is 0. The default value is 25%.

    For example, when this value is set to 30%, the old ReplicaSet can be scaled down to 70% of
    desired Pods immediately when the rolling update starts. Once new Pods are ready,
    old ReplicaSet can be scaled down further, followed by scaling up the new ReplicaSet,
    ensuring that the total number of Pods available at all times during the update is
    at least 70% of the desired Pods.

    Max Surge
    .spec.strategy.rollingUpdate.maxSurge is an optional field that specifies the maximum number
    of Pods that can be created over the desired number of Pods. The value can be an absolute
    number (for example, 5) or a percentage of desired Pods (for example, 10%). The value cannot
    be 0 if MaxUnavailable is 0. The absolute number is calculated from the percentage by rounding up.
    The default value is 25%.

    For example, when this value is set to 30%, the new ReplicaSet can be scaled up immediately
    when the rolling update starts, such that the total number of old and new Pods does not exceed
    130% of desired Pods. Once old Pods have been killed, the new ReplicaSet can be scaled up further,
    ensuring that the total number of Pods running at any time during the update is at most 130%
    of desired Pods.

    maxSurge:滚动更新时最多可以多启动多少个pod
    maxUnavailable:滚动更新时最大可以删除多少个pod
    maxSurge和maxUnavailable可以用来决定更新是的最大pod数和最小pod数
    是先启动一个pod再删除一个pod还是先删除一个pod再启动一个pod
    例如
    replicas是5
    maxSurge: 1
    maxUnavailable: 0
    更新时 最大的pod数是 replicas+ maxSurge = 5+1 =6,最大的个数是6
    最小pod数是 replicas - maxUnavailable = 5-0 = 5,最小pod数是5,所以只能先启动一个pod,再删除一个pod

    https://blog.csdn.net/huiyanshizhen21/article/details/103146788

  • 相关阅读:
    Kafka基本命令
    Vue右键菜单
    ES6
    display: table-cell;的妙用
    关于git的总结
    js 数组的增删改查
    es6 import export 引入导出变量方式
    关于electron的跨域问题,有本地的图片的地址,访问不了本地的图片
    input type= file 如何更改自定义的样式
    vue.js 常用语法总结(一)
  • 原文地址:https://www.cnblogs.com/yaohuimo/p/13666932.html
Copyright © 2011-2022 走看看