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

AWS Load Balancer Controller无法在EKS Fargate上启动求助

问题分析与解决方案

错误原因拆解

  1. 第一个调度失败错误:集群所有节点都是Fargate节点,默认调度器未配置容忍Fargate节点的eks.amazonaws.com/compute-type: fargate污点,导致Pod无法调度。
  2. 第二个Fargate配置错误:Fargate调度器要求Pod必须携带与Fargate Profile匹配的标签eks.amazonaws.com/fargate-profile,当前Deployment的Pod模板缺少该标签,而CoreDNS能正常运行是因为其Pod标签已匹配Fargate Profile的选择规则。

具体解决步骤

1. 确认Fargate Profile配置

先查看你的Fargate Profile的选择器规则,确认它包含kube-system命名空间,以及对应的标签匹配规则:

aws eks describe-fargate-profile --cluster-name dsa-ph-dev-cluster --fargate-profile-name <你的Fargate Profile名称>

记录输出中selectors字段里的标签(例如eks.amazonaws.com/fargate-profile: my-fargate-profile)。

2. 修改Deployment配置

更新aws-load-balancer-controller的Deployment,添加匹配Fargate Profile的标签,并移除不必要的手动调度器指定:

apiVersion: apps/v1
kind: Deployment
metadata:
  # 原元数据部分保持不变
spec:
  # 原spec其他部分保持不变
  template:
    metadata:
      annotations:
        kubectl.kubernetes.io/restartedAt: "2023-07-13T14:38:36+02:00"
        prometheus.io/port: "8080"
        prometheus.io/scrape: "true"
      labels:
        app.kubernetes.io/instance: aws-load-balancer-controller
        app.kubernetes.io/name: aws-load-balancer-controller
        # 添加Fargate Profile匹配标签,替换为你的Profile名称
        eks.amazonaws.com/fargate-profile: <你的Fargate Profile名称>
    spec:
      # 移除手动指定的fargate-scheduler,Fargate会自动处理调度
      # schedulerName: fargate-scheduler
      # 可选:注释或删除Pod反亲和性配置(Fargate节点hostname为临时值,该配置可能干扰调度)
      # affinity:
      #   podAntiAffinity:
      #     preferredDuringSchedulingIgnoredDuringExecution:
      #     - podAffinityTerm:
      #         labelSelector:
      #           matchExpressions:
      #           - key: app.kubernetes.io/name
      #             operator: In
      #             values:
      #             - aws-load-balancer-controller
      #         topologyKey: kubernetes.io/hostname
      #       weight: 100
      # 其余spec内容保持不变

3. 应用配置并验证

应用修改后的Deployment:

kubectl apply -f <修改后的Deployment文件路径> -n kube-system

查看Pod调度状态:

kubectl get pods -n kube-system -l app.kubernetes.io/name=aws-load-balancer-controller

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.16 12:53:27