gpt4 book ai didi

amazon-web-services - EKS ALB 无法自动发现子网

转载 作者:行者123 更新时间:2023-12-03 20:21:05 24 4
gpt4 key购买 nike

背景 :

  • 我有一个 VPC与 3 个公共(public) subnets (子网可以访问互联网网关)
  • 我在这个 VPC 中有一个 EKS 集群,EKS 集群是从控制台创建的,而不是使用 eksctl
  • 我用了this来自官方 aws 文档的教程,我设法设置了我的 ALB Controller 并且 Controller 运行完美:

  • 集群包含两个节点组:
  • 第一个节点组有一个节点类型:t3a.micro
  • 第二个节点组有一个节点类型:t3.small
  • $ kubectl get deployment -n kube-system aws-load-balancer-controller
    NAME READY UP-TO-DATE AVAILABLE AGE
    aws-load-balancer-controller 1/1 1 1 60m
    我使用了他们的游戏示例,这是 list 文件:
    ---
    apiVersion: v1
    kind: Namespace
    metadata:
    name: game-2048
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
    namespace: game-2048
    name: deployment-2048
    spec:
    selector:
    matchLabels:
    app.kubernetes.io/name: app-2048
    replicas: 1
    template:
    metadata:
    labels:
    app.kubernetes.io/name: app-2048
    spec:
    containers:
    - image: alexwhen/docker-2048
    imagePullPolicy: Always
    name: app-2048
    ports:
    - containerPort: 80
    ---
    apiVersion: v1
    kind: Service
    metadata:
    namespace: game-2048
    name: service-2048
    spec:
    ports:
    - port: 80
    targetPort: 80
    protocol: TCP
    type: NodePort
    selector:
    app.kubernetes.io/name: app-2048
    ---
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
    namespace: game-2048
    name: ingress-2048
    annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip
    spec:
    rules:
    - http:
    paths:
    - path: /*
    backend:
    serviceName: service-2048
    servicePort: 80
    但是,当我描述入口时:我收到以下消息
    DNDT@DNDT-DEV-2 MINGW64 ~/Desktop/.k8s
    $ kubectl describe ingress/ingress-2048 -n game-2048
    Name: ingress-2048
    Namespace: game-2048
    Address:
    Default backend: default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
    Rules:
    Host Path Backends
    ---- ---- --------
    *
    /* service-2048:80 (172.31.4.64:80)
    Annotations: alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip
    kubernetes.io/ingress.class: alb
    Events:
    Type Reason Age From Message
    ---- ------ ---- ---- -------
    Warning FailedBuildModel 9s (x13 over 32s) ingress Failed build model due to couldn't auto-discover subnets: unable to discover at least one subnet

    以下是在 3 个子网上设置的标签:
    enter image description here
    这是子网的路由表,您可以看到它们附加了一个 Internet gw:
    enter image description here
    我到处搜索,他们都在谈论添加标签,我从头开始创建了一个全新的集群,但仍然遇到这个问题,还有其他我遗漏的东西吗?
    我查了 this答案,但它不相关,因为它适用于 ELB 而不是 ALB,
    =================================
    更新:
    我明确添加了子网:
    alb.ingress.kubernetes.io/subnets: subnet-xxxxxx, subnet-xxxxx, subnet-xxx
    现在我得到了我的外部 IP,但有一些警告
    $  kubectl describe ingress/ingress-2048 -n game-2048
    Name: ingress-2048
    Namespace: game-2048
    Address: k8s-game2048-ingress2-330cc1efad-115981283.eu-central-1.elb.amazonaws.com
    Default backend: default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
    Rules:
    Host Path Backends
    ---- ---- --------
    *
    /* service-2048:80 (172.31.13.183:80)
    Annotations: alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/subnets: subnet-8ea768e4, subnet-bf2821f2, subnet-7c023801
    alb.ingress.kubernetes.io/target-type: ip
    kubernetes.io/ingress.class: alb
    Events:
    Type Reason Age From Message
    ---- ------ ---- ---- -------
    Warning FailedDeployModel 43s ingress Failed deploy model due to ListenerNotFound: One or more listeners not found
    status code: 400, request id: e866eba4-328c-4282-a399-4e68f55ee266
    Normal SuccessfullyReconciled 43s ingress Successfully reconciled
    也转到浏览器并使用外部 ip 返回: 503 Service Temporarily Unavailable

    最佳答案

    确保 aws-load-balancer-controller 部署中的 --cluster-name 配置正确。
    采用kubectl get deployment -n kube-system aws-load-balancer-controller -oyaml |grep "cluster-name"获取部署中的集群名称。
    如果不正确,请使用下一个命令编辑部署并重命名:kubectl edit deployment -n kube-system aws-load-balancer-controller

    关于amazon-web-services - EKS ALB 无法自动发现子网,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66039501/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com