DEBUG.WIKI
RackNerd;$21.99/年 · 1GB KVM
搬瓦工;先看线路,再选 VPS;CN2 GIA · 对应线路套餐;查看线路 →
腾讯云;让你的想法跑起来;轻量服务器 · 建站 / Docker / API;查看产品 →

解决 Argo Rollouts 报错 trafficRouting ALB action annotation mismatch 路由规则异常修复

排查 使用 AWS Load Balancer Controller (ALB) 配合 Argo Rollouts 流量切分报错 Invalid ingress rule: forward action annotation missing,分析 注解格式规范。

问题现象

配置基于 AWS ALB 的金丝雀权重分流时,Rollout 控制器报错:

[Warning] SyncRolloutError: Ingress alb-ingress does not have an action annotation matching rule for action web-app-root

触发根因

  1. Argo Rollouts 对 AWS ALB 的原生流量切分机制依赖 Ingress 注解 alb.ingress.kubernetes.io/actions.<action-name>;
  2. Ingress 资源中的 Service 名字必须精确匹配为 use-annotation;
  3. Rollout 的 spec.strategy.canary.trafficRouting.alb 中引用的 action 标识符拼写存在大小写或字符不一致。

解决步骤

规范 Ingress 资源中的 ALB 前向权重注解

在 Ingress 中定义动作占位符:

metadata:
  annotations:
    alb.ingress.kubernetes.io/actions.web-app-root: |
      {"type":"forward","forwardConfig":{"targetGroups":[{"serviceName":"web-stable","servicePort":80,"weight":100},{"serviceName":"web-canary","servicePort":80,"weight":0}]}}
spec:
  rules:
    - http:
        paths:
          - path: /
            backend:
              service:
                name: web-app-root
                port:
                  name: use-annotation

确保 Rollout 准确绑定该 Ingress 与 Action

在 Rollout 中配置:

spec:
  strategy:
    canary:
      trafficRouting:
        alb:
          ingress: alb-ingress
          servicePort: 80
          rootService: web-app-root

验证确认

重新触发更新:

Argo Rollouts 自动动态修改 ALB Ingress 的 TargetGroup 权重比例,0% 到 100% 流量无缝精确切分。