Skip to content

npd-node-replace-v2-2.0.0

Choose a tag to compare

🍦

npd-node-replace v2.0.0

面向 Amazon EKS 中国区集群的节点自动修复组件,v2 版本进行了架构级重构。

镜像:
zxxxxzz/npd-node-replace-v2:2db151f-20260410-0652
https://hub.docker.com/r/zxxxxzz/npd-node-replace-v2

v2.0.1 修订版镜像,适配本release :
zxxxxzz/npd-node-replace-v2:b25faf5-20260410-1351

helm chart:
https://github.com/normalzzz/npd-node-replace/releases/download/npd-node-replace-v2-2.0.0/npd-node-replace-v2-2.0.0.tgz

🚀 新功能

ToleranceConfig 自定义资源

  • 容忍策略从 ConfigMap(JSON 文件)升级为 Kubernetes CRD(Cluster scope)
  • 支持热更新,修改 CR 后自动生效,无需重启组件
  • 通过 node label 匹配,为不同类型节点配置独立策略

积分桶(Score Bucket)机制

  • 替代 v1 的简单次数阈值,不同事件类型可配置不同权重分数
  • 滑动时间窗口 eventWindowInMinutes,过期事件自动失效
  • lastActionTime 下界过滤,已消费事件不会被重复计分

Escalation 升级操作

  • 首次 action(如 reboot)完成后,保留 NIR 用于 escalation 评估
  • cooldown 窗口内积分桶再次打满,自动升级为更强操作(replace 或 paging)
  • cooldown 过期后定时清理 NIR

并发控制

  • maxConcurrentActions 限制同一规则下同时处理的节点数
  • 防止多节点同时出问题导致集群容量骤降

Dry-run 模式

  • dryRun: true 走完所有判定逻辑但不执行操作
  • 仅发送 SNS 通知,用于上线前验证规则是否合理

Prometheus Metrics

  • :9090/metrics 暴露指标
  • npd_node_replace_score_bucket_current{node, nodegroup} — 积分桶水位
  • npd_node_replace_actions_total{node, action, escalated} — 操作计数
  • npd_node_replace_events_total{node, event_type} — 事件计数
  • npd_node_replace_nir_active — 活跃 NIR 数量

其他改进

  • Reboot 安全等待:等待节点真正完成重启并恢复 Ready 后再 uncordon
  • 节点类型过滤:自动过滤 Karpenter 和 Fargate 节点
  • SNS 通知分类:reboot/replace/paging/escalation/dry-run/cooldown-expired 等场景发送不同主题
  • Leader Election:通过 Lease 支持多副本部署

⚠️ Breaking Changes

  • 节点标签白名单 npd-node-replace-enabled=true 已移除,改为 ToleranceConfig 中的 allowOperation 字段
  • tolerance ConfigMap 不再使用,替换为 ToleranceConfig CRD
  • SNSNotify 接口从 bool 参数改为 reason string

📦 新增 CRD

  • toleranceconfigs.nodeissuereporter.xingzhan.io(Cluster scope)
  • nodeissuereports.nodeissuereporter.xingzhan.io 新增字段:scoreInBucket、lastActionTime、lastUpdateTime、escalated

🔧 Helm Chart

新 chart 名称:npd-node-replace-v2(不影响 v1 的 npd-node-replace)

helm repo add npd https://normalzzz.github.io/npd-node-replace/
helm repo update
helm install <release> npd/npd-node-replace-v2 --namespace <namespace> -f values.yaml

📖 文档

🔄 从 v1 升级

  1. Apply 新 CRD:kubectl apply -f config/crd/
  2. 更新 ClusterRole:kubectl apply -f deploy/npd-node-replace-clusterrole.yaml
  3. 创建 ToleranceConfig CR
  4. 更新镜像版本
  5. 删除旧的 tolerance ConfigMap

详细步骤参见 v1 vs v2 对比文档