You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AWS ALB Ingress idle_timeout不生效及目标组找不到问题求助

AWS ALB Ingress 两大问题排查与解决

问题现象

  1. ALB空闲超时不生效:已在Ingress annotation中配置alb.ingress.kubernetes.io/load-balancer-attributes: idle_timeout.timeout_seconds=1200,但部署后ALB空闲超时始终保持默认120秒;手动在控制台修改为1200秒后,重新部署Ingress又会恢复为120秒。
  2. TargetGroupNotFound错误:AWS ALB Controller Pod日志持续报错,提示目标组arn:aws:elasticloadbalancing:eu-central-1::targetgroup/k8s-test---d5f2ecdcad/837c1cc34395c35f不存在,对应的TargetGroupBinding资源k8s-test---d5f2ecdcad(test命名空间)无法正常 reconcile。

问题根源

TargetGroupBinding资源与实际AWS目标组不同步(目标组已被删除但K8s资源残留),导致ALB Controller在 reconcile 过程中出现异常,进而无法正确应用Ingress中配置的ALB属性(包括空闲超时)。此外,Ingress配置中enabled: enable存在语法问题(应为布尔值true),可能影响配置加载。

解决步骤

1. 修复TargetGroupNotFound错误

  • 查看无效的TargetGroupBinding资源:
    kubectl get targetgroupbindings elbv2.k8s.aws -n test
    
    确认k8s-test---d5f2ecdcad资源存在。
  • 删除无效的TargetGroupBinding:
    kubectl delete targetgroupbindings elbv2.k8s.aws k8s-test---d5f2ecdcad -n test
    
  • 触发Ingress重新 reconcile:
    通过修改Ingress的annotation强制触发同步:
    kubectl annotate ingress <你的Ingress名称> alb.ingress.kubernetes.io/force-reconcile=true -n test --overwrite
    
    或者直接删除并重新部署Ingress资源。

2. 修正Ingress配置错误

将Ingress配置中的enabled: enable改为布尔值true:

ingress:
  enabled: true  # 原配置为enable,需修正为true
  className: alb
  annotations:
    # 其余annotation保持不变
    alb.ingress.kubernetes.io/load-balancer-attributes: idle_timeout.timeout_seconds=1200

3. 验证空闲超时配置生效

  • 重新部署Ingress:应用修正后的配置。
  • 检查ALB属性:
    使用AWS CLI查看ALB的空闲超时设置:
    aws elbv2 describe-load-balancer-attributes --load-balancer-arn <你的ALB ARN> | grep idle_timeout
    
    或直接在AWS控制台进入ALB详情页,查看"属性"中的"空闲超时"是否为1200秒。

额外排查点

  • 确认AWS ALB Controller版本为v2.4.0及以上,旧版本可能对load-balancer-attributes的支持存在缺陷。
  • 检查IngressClass alb是否已正确配置并关联到AWS ALB Controller:
    kubectl get ingressclass alb
    

内容的提问来源于stack exchange,提问作者Ercan Koc

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 23:00:39