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

  • 相关阅读:
    Exsi上Windows主机增加硬盘容量
    第6章:vuerouter,vuecli和单文件组件
    Python之爬取天气预报并生成图表
    第3章:vue生命周期及实例的属性
    Python 获得NOAA全球开放气象数据
    第5章:组件即组件间的通信
    MACBOOK M1 PRO 下运行.NET CORE(MAC下如何与X86_64兼容)
    DOTNET 运行AESGCM程序 ON MACOS(错误ALGORITHM ‘AESGCM’ IS NOT SUPPORTED ON THIS PLATFORM)
    1.3\~1.4 控制措施类型、安全框架
    mac 安装brew带来的种种问题
  • 原文地址:https://www.cnblogs.com/yaohuimo/p/13666932.html
Copyright © 2011-2022 走看看