Skip to content

Commit 16e8b1f

Browse files
authored
Merge pull request #4424 from dumlutimuralp/main
New use case "Legacy App Integration"
2 parents a3c3cac + 95d32ea commit 16e8b1f

File tree

1 file changed

+117
-0
lines changed
  • docs/guide/use_cases/legacy_app_integration

1 file changed

+117
-0
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
title : Legacy App Integration
3+
---
4+
5+
## Motivation
6+
7+
Organizations may need a unified load balancing approach to maintain operational simplicity and cost efficiency while gradually migrating from legacy Amazon EC2 based applications to modern Amazon EKS microservices. This single load balancer strategy enables seamless user experience and supports phased modernization without disrupting existing services during digital transformation initiatives. The AWS Load Balancer Controller provides two approaches to achieve this unified load balancing architecture with an Application Load Balancer (ALB). This document dives into the implementation details of the second approach.
8+
9+
### Approach 1 : [Externally Managed Load Balancer](https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/guide/use_cases/self_managed_lb/)
10+
11+
In this approach, there are no Ingress objects configured on the EKS cluster. Instead:
12+
13+
1. Configure all forwarding rules and target groups directly on the AWS ALB using preferred tool (AWS SDK, CDK, API, CloudFormation, Terraform, etc.)
14+
2. Configure TargetGroupBinding objects on the EKS cluster to associate each Kubernetes Service with a Target Group on the AWS ALB
15+
3. The AWS Load Balancer Controller continuously tracks TargetGroupBindings and updates the target groups as pods change
16+
17+
### Approach 2 : `actions` annotation
18+
19+
In this approach,
20+
21+
1. Configure Ingress objects on the EKS cluster
22+
2. Configure target groups for legacy applications on the ALB
23+
3. Use the [alb.ingress.kubernetes.io/actions.${action-name}](https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/guide/ingress/annotations/#actions) annotation that associates the specific ingress rules with the target groups configured for legacy applications
24+
4. When the Ingress object is deleted, the controller automatically deletes the associated target group(s)
25+
26+
## Prerequisites
27+
28+
- An EKS Cluster with [AWS Load Balancer Controller](https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/deploy/installation/)
29+
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/)
30+
- A few EC2 instances to simulate a legacy application.
31+
- A sample application on the EKS cluster which is exposed through a Kubernetes service
32+
33+
## Example
34+
35+
1. Create an Ingress object for the sample application. Sample manifest shown below.
36+
37+
```yaml
38+
apiVersion: networking.k8s.io/v1
39+
kind: Ingress
40+
metadata:
41+
name : myingress
42+
annotations:
43+
alb.ingress.kubernetes.io/load-balancer-name: myalb
44+
alb.ingress.kubernetes.io/scheme: internet-facing
45+
alb.ingress.kubernetes.io/target-type: ip
46+
spec:
47+
ingressClassName: alb
48+
rules:
49+
- http:
50+
paths:
51+
- backend:
52+
service:
53+
name: sampleservice
54+
port:
55+
number: 80
56+
path: /sampleapp
57+
pathType: Prefix
58+
```
59+
60+
In this example the sample application on the EKS cluster is exposed through a Kubernetes service type of `ClusterIP` with the name `sampleservice`.
61+
62+
2. Configure a Target Group for Legacy Application
63+
64+
Navigate to the AWS Console and locate the ALB created by the AWS Load Balancer Controller. Create a new target group for the legacy application. Add the EC2 instances as targets. Copy the Amazon Resource Name (ARN) of the target group.
65+
66+
3. Update the Ingress object to include routing rules for the legacy application
67+
68+
Use `kubectl edit ingress myingress` or any other method to apply these changes.
69+
70+
```yaml
71+
apiVersion: networking.k8s.io/v1
72+
kind: Ingress
73+
metadata:
74+
annotations:
75+
alb.ingress.kubernetes.io/actions.ec2: |
76+
{
77+
"type":"forward",
78+
"targetGroupARN": "YOUR_TARGET_GROUP_ARN_HERE"
79+
}
80+
spec:
81+
rules:
82+
- http:
83+
paths:
84+
- backend:
85+
service:
86+
name: ec2
87+
port:
88+
name: use-annotation
89+
path: /legacy
90+
pathType: Exact
91+
```
92+
93+
The `action-name` in the annotation must match the serviceName in the Ingress rules, and servicePort must be `use-annotation`. In this example the action-name of `ec2` matches the serviceName `ec2`.
94+
95+
### Testing
96+
97+
From a client machine, test access to all applications using the ALB DNS name:
98+
99+
- **Legacy application**: `curl http://ALB_DNS_NAME/legacy`
100+
- **Microservice**: `curl http://ALB_DNS_NAME/sampleapp`
101+
102+
103+
## Considerations
104+
105+
- Review ALB service quotas to ensure your architecture fits within limits
106+
- Use the `group.name` annotation to group multiple Ingress objects on the same ALB
107+
- Use the `group.order` annotation to prioritize Ingress objects in the ALB rules list for better performance
108+
- When deleting Ingress objects, the controller will automatically clean up associated target groups
109+
110+
## References
111+
112+
- [TargetGroupBinding Documentation](https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.13/guide/targetgroupbinding/targetgroupbinding/)
113+
- [Ingress Actions Annotation](https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.13/guide/ingress/annotations/#actions)
114+
- [ALB Listener Rules](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-rules.html)
115+
- [ALB Service Quotas](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-limits.html)
116+
- [Group Name Annotation](https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.13/guide/ingress/annotations/#group.name)
117+
- [Group Order Annotation](https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.13/guide/ingress/annotations/#group.order)

0 commit comments

Comments
 (0)