Bakula33
Bakula33

Reputation: 75

Multiple services with ALB ingress

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.

Upvotes: 0

Views: 3697

Answers (3)

David Yaffe
David Yaffe

Reputation: 31

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

Upvotes: 1

Kaish kugashia
Kaish kugashia

Reputation: 254

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

Upvotes: 2

grahamlyons
grahamlyons

Reputation: 717

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

Upvotes: 2

Related Questions