繁体   English   中英

AWS EKS Fargate Ingress 没有地址

[英]AWS EKS Fargate Ingress Has No Address

更新

因此,我遵循了AWS 文档,了解如何使用eksctl工具通过 Fargate 设置 EKS 集群。 一切都进行得很顺利,但是当我到达部署实际应用程序的部分时,我没有得到任何端点,并且入口控制器没有与之关联的地址。 如这里所见:

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

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

这是我为进行设置而遵循的初始文章。 我已经执行了所有步骤,但只用 alb 撞到了墙: 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注释明确告诉 Ingress 资源在哪里/如何为目标组执行健康检查。 有关注释语义,请参阅 ALB Ingress 控制器文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM