jitongxi

k8s 某个 deployment 如何自动伸缩到 node 的数量

  •  
  •   jitongxi · Dec 12, 2023 · 3233 views
    This topic created in 1066 days ago, the information mentioned may be changed or developed.

    如果,如何自动伸缩后,保持每个 node 上都有这个 deployment 的 pod

    有没有运维大佬指点一下

    9 replies  •  2023-12-13 15:28:23 +08:00
    longfei210
    longfei210
    Dec 12, 2023
    1
    容器编排的控制器改为 DaemonSet
    midjourney
    midjourney
    Dec 12, 2023❤️1
    2
    1. Deployment -> DaemonSet
    2. hpa 最小为 node 数量,并开启 pod 节点反亲和
    jitongxi
    jitongxi
    OP
    Dec 12, 2023
    3
    好了 , 谢谢两位运维大佬
    kevin123456
    kevin123456
    Dec 12, 2023
    4
    2 楼的#2 是多余的吧
    CivAx
    CivAx
    Dec 12, 2023❤️2
    5
    @kevin123456 不多余。如果应用不适用于 DaemonSet ,比如我现有 5 个 Pod 跑在 3 个 node 上,当我的 node scaling 到 20 个的时候我希望 pod 能扩编到 12 个、且均匀分布在所有节点上时,HPA 的 autoscaling + podAntiAffinity 才是正确且优雅的解法,忽视场景粗暴使用 DaemonSet 会造成 Pod 数量过少,或者资源浪费。
    freemoon
    freemoon
    Dec 13, 2023
    6
    @kevin123456 #4 第一个方法太局限,第二个才是更普遍的做法。
    jitongxi
    jitongxi
    OP
    Dec 13, 2023
    7
    @midjourney 有个问题,如果用第二种方法,Deployment 特别多的时候,加一个 node ,然后每个都要去改吗
    Insa
    Insa
    Dec 13, 2023
    8
    @jitongxi 后面加 node 不用调整
    midjourney
    midjourney
    Dec 13, 2023
    9
    @jitongxi 不需要 hpa 会自动扩容
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4451 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 07:12 · PVG 15:12 · LAX 23:12 · JFK 02:12
    ♥ Do have faith in what you're doing.