Alb Intress多次服务

发布于 2025-01-28 09:40:54 字数 148 浏览 2 评论 0原文

我已经与Fargate创建了EKS群集。我部署了两个微服务。一切都可以与入口和两个独立的应用负载平衡器正常工作。我正在尝试使用一个ALB创建入口,该ALB将将流量路由到服务。潜在的问题是两种服务都使用相同的端口(8080)。如何为此问题创建入口?另外,我在53号公路上有一个注册域。

I have created EKS cluster with Fargate. I deployed two microservices. Everything is working properly with ingress and two separate application load balancers. I am trying to create ingress with one alb which will route the traffic to the services. The potential problem is that both services use the same port (8080). How to create ingress for this problem? Also I have got a registered domain in route 53.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

沫雨熙 2025-02-04 09:40:54

我相信您可以使用 abs indress Controller 。

I believe you can accomplish this using the ALB Ingress Controller.

野侃 2025-02-04 09:40:54

即使它们使用相同的端口,您也可以使用EKS内部的服务有一个常见的ALB;您可以根据路径将其与ALB上的不同侦听器规则相关联。

如果您使用的是入口控制器,则可以配置入口以处理这些不同的侦听器规则的创建。

例如。如果您使用的是AWS ALB INGRESS控制器,则可以拥有一个常见的ALB,然后用注释创建入口:

alb.ingress.kubernetes.io/group.name:my-group

该组的所有入口部分将与该组相关的相同ALB。

结帐 - userguide-alb-ingress 以获取更多信息

You can have a common ALB for your services running inside EKS, even if they use the same port; you can associate it with different listener rules on ALB based on path.

If you are using an ingress controller, your ingress can be configured to handle the creation of these different listener rules.

For eg. if you are using aws alb ingress controller, you can have one common alb and then create ingresses with annotation:

alb.ingress.kubernetes.io/group.name: my-group

All ingresses part of this group will be under the same alb associated to the group.

checkout -userguide-alb-ingress for more info

知足的幸福 2025-02-04 09:40:54

两种服务都有相同的端口都没关系。
这只是向他们发送流量的方法,他们具有不同的IPS

入口与EKS和Fargate的完美工作,

唯一的问题是它将流量移至第二服务,而不是将服务的根源移至服务的根源(它添加了“//执行人“通往第二服务的路径)

>apiVersion: networking.k8s.io/v1
>kind: Ingress
>metadata:
>    name: ingress-airdqa
>    labels:
>        app: air_dqa
>        chart: {{ .Chart.Name }}-{{ .Chart.Version }}
>        release: {{ .Release.Name }}
>        heritage: {{ .Release.Service }}
>        app.kubernetes.io/name: external-dns
>    annotations:
>        alb.ingress.kubernetes.io/target-type: ip
>        alb.ingress.kubernetes.io/scheme: internet-facing
>        alb.ingress.kubernetes.io/healthcheck-path: /healthz
>        alb.ingress.kubernetes.io/healthcheck-interval-seconds: '300'
>        alb.ingress.kubernetes.io/rewrite-target: /
>
>spec: 
>    rules:
>      - http:
>            paths:
>            - path: /
>              pathType: Prefix
>              backend:
>                  service:
>                      name: service-dqa-django
>                      port:
>                          number: 80
>            - path: "/executor"
>              pathType: Prefix
>              backend:
>                  service:
>                      name: service-dqa-executor
>                      port:
>                          number: 80

It doesn't matter that both services have the same port.
It's just how to send them the traffic, they have different Ips

The ingress below work perfect with EKS and fargate

The only problem is that it move traffic to the second service but not to the root of the service (it's add the suffix of "/executor" to the path of the second service)

>apiVersion: networking.k8s.io/v1
>kind: Ingress
>metadata:
>    name: ingress-airdqa
>    labels:
>        app: air_dqa
>        chart: {{ .Chart.Name }}-{{ .Chart.Version }}
>        release: {{ .Release.Name }}
>        heritage: {{ .Release.Service }}
>        app.kubernetes.io/name: external-dns
>    annotations:
>        alb.ingress.kubernetes.io/target-type: ip
>        alb.ingress.kubernetes.io/scheme: internet-facing
>        alb.ingress.kubernetes.io/healthcheck-path: /healthz
>        alb.ingress.kubernetes.io/healthcheck-interval-seconds: '300'
>        alb.ingress.kubernetes.io/rewrite-target: /
>
>spec: 
>    rules:
>      - http:
>            paths:
>            - path: /
>              pathType: Prefix
>              backend:
>                  service:
>                      name: service-dqa-django
>                      port:
>                          number: 80
>            - path: "/executor"
>              pathType: Prefix
>              backend:
>                  service:
>                      name: service-dqa-executor
>                      port:
>                          number: 80
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文