AWS EKS Fargate Ingress 没有地址

AWS EKS Fargate Ingress Has No Address

已更新

所以,我遵循了 AWS docs on how to setup an EKS cluster with Fargate using the eksctl 工具。一切都进行得很顺利,但是当我到达部署实际应用程序的部分时,我没有得到端点,入口控制器也没有与之关联的地址。如此处所示:

NAME                     HOSTS   ADDRESS   PORTS   AGE
testapp-ingress           *                 80      129m

所以,外打打不开。但是测试应用程序(2048 游戏)有一个来自与入口关联的 elb 的地址。我认为这可能是建议的子网标签 here 并且我的子网没有正确标记,所以我按照那篇文章中建议的方式标记了它们。仍然没有运气。

这是我开始设置时遵循的第一篇文章。我已经执行了所有步骤,只用白蛋白撞墙:https://docs.aws.amazon.com/eks/latest/userguide/fargate-getting-started.html#fargate-gs-next-steps

这是我关注的 alb 文章:https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html

我按照步骤部署示例应用 2048,效果很好。我已经使我的配置非常相似,它应该可以工作。我已经完成了所有步骤。这是我的配置,新配置如下:

deployment yaml>>>
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: "testapp-deployment"
  namespace: "testapp-qa"
spec:
  selector:
    matchLabels:
      app: "testapp"
  replicas: 5
  template:
    metadata:
      labels:
        app: "testapp"
    spec:
      containers:
      - image: xxxxxxxxxxxxxxxxxxxxxxxxtestapp:latest
        imagePullPolicy: Always
        name: "testapp"
        ports:
        - containerPort: 80
---
service yaml>>>
apiVersion: v1
kind: Service
metadata:
  name: "testapp-service"
  namespace: "testapp-qa"
spec:
  ports:
    - port: 80
      targetPort: 80
      protocol: TCP
      name: http
  type: NodePort
  selector:
    app: "testapp"
---
ingress yaml >>>
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: "testapp-ingress"
  namespace: "testapp-qa"
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
  labels:
    app: testapp-ingress
spec:
  rules:
    - http:
        paths:
          - path: /*
            backend:
              serviceName: "testapp-service"
              servicePort: 80
---
namespace yaml>>>
apiVersion: v1
kind: Namespace
metadata:
  name: "testapp-qa"

这是来自入口控制器的一些日志>>

E0316 22:32:39.776535       1 controller.go:217] kubebuilder/controller "msg"="Reconciler error" "error"="failed to reconcile targetGroups due to failed to reconcile targetGroup targets due to Unable to DescribeInstanceStatus on fargate-ip-xxxxxxxxxxxx.ec2.internal: InvalidInstanceID.Malformed: Invalid id: \"fargate-ip-xxxxxxxxxxxx.ec2.internal\"\n\tstatus code: 400, request id: xxxxxxxxxxxx"  "controller"="alb-ingress-controller" "request"={"Namespace":"testapp-qa","Name":"testapp-ingress"}
E0316 22:36:28.222391       1 controller.go:217] kubebuilder/controller "msg"="Reconciler error" "error"="failed to reconcile targetGroups due to failed to reconcile targetGroup targets due to Unable to DescribeInstanceStatus on fargate-ip-xxxxxxxxxxxx.ec2.internal: InvalidInstanceID.Malformed: Invalid id: \"fargate-ip-xxxxxxxxxxxx.ec2.internal\"\n\tstatus code: 400, request id: xxxxxxxxxxxx"  "controller"="alb-ingress-controller" "request"={"Namespace":"testapp-qa","Name":"testapp-ingress"}

根据@Michael Hausenblas 评论中的建议,我在我的服务中为 alb 入口添加了注释。

既然我的入口控制器使用了正确的 ELB,我检查了日志,因为我仍然无法访问我的应用程序的 /healthcheck。日志:

E0317 16:00:45.643937       1 controller.go:217] kubebuilder/controller "msg"="Reconciler error" "error"="failed to reconcile targetGroups due to failed to reconcile targetGroup targets due to Unable to DescribeInstanceStatus on fargate-ip-xxxxxxxxxxx.ec2.internal: InvalidInstanceID.Malformed: Invalid id: \"fargate-ip-xxxxxxxxxxx.ec2.internal\"\n\tstatus code: 400, request id: xxxxxxxxxxx-3a7d-4794-95fb-a18835abe0d3"  "controller"="alb-ingress-controller" "request"={"Namespace":"testapp-qa","Name":"testapp"}
I0317 16:00:47.868939       1 rules.go:82] testapp-qa/testapp-ingress: modifying rule 1 on arn:aws:elasticloadbalancing:us-east-1:xxxxxxxxxxx:listener/app/xxxxxxxxxxx-testappqa-testappin-b879/xxxxxxxxxxx/6b41c0d3ce97ae6b
I0317 16:00:47.890674       1 rules.go:98] testapp-qa/testapp-ingress: rule 1 modified with conditions [{    Field: "path-pattern",    Values: ["/*"]  }]

更新

我更新了我的配置。我没有更多的错误,但仍然无法访问我的端点来测试我的应用程序是否正在接受流量。它可能与 fargate 或我没有看到的 AWS 方面有关。这是我更新的配置:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: "testapp"
  namespace: "testapp-qa"
spec:
  selector:
    matchLabels:
      app: "testapp"
  replicas: 5
  template:
    metadata:
      labels:
        app: "testapp"
    spec:
      containers:
      - image: 673312057223.dkr.ecr.us-east-1.amazonaws.com/wood-testapp:latest
        imagePullPolicy: Always
        name: "testapp"
        ports:
        - containerPort: 9898
---
apiVersion: v1
kind: Service
metadata:
  name: "testapp"
  namespace: "testapp-qa"
  annotations: 
    alb.ingress.kubernetes.io/target-type: ip
spec:
  ports:
    - port: 80
      targetPort: 9898
      protocol: TCP
      name: http
  type: NodePort
  selector:
    app: "testapp"
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: "testapp-ingress"
  namespace: "testapp-qa"
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/healthcheck-path: /healthcheck
  labels:
    app: testapp
spec:
  rules:
    - http:
        paths:
          - path: /*
            backend:
              serviceName: "testapp"
              servicePort: 80
---
apiVersion: v1
kind: Namespace
metadata:
  name: "testapp-qa"

在您的服务中,尝试添加以下注释:

  annotations:
    alb.ingress.kubernetes.io/target-type: ip

而且您还需要通过 alb.ingress.kubernetes.io/healthcheck-path 注释 where/how 明确告诉 Ingress 资源执行目标组的健康检查。有关注释语义,请参阅 ALB Ingress 控制器 docs