EKS ALB 504 Gateway Time-out

2023. 6. 7. 18:38Dev/EKS

728x90

EKS에서 AWS Load Balancer Controller를 설치하고 Ingress를 통해 ALB를 프로비저닝 했다.

처음에는 default로 생기는 security groups을 사용하다가

alb.ingress.kubernetes.io/security-groups: sg-xxxx, nameOfSg1, nameOfSg2

이 annotations를 추가해서 직접 생성한 보안그룹을 추가했다.

 

하지만 서비스에서 504 error가 발생했다.
해결 방법은 alb.ingress.kubernetes.io/manage-backend-security-group-rules
어노테이션을 추가로 등록해줘야 한다.

이유는 공식 문서에 나오는데 

 

When this annotation is not present, the controller will automatically create one security group, the security group will be attached to the LoadBalancer and allow access from inbound-cidrs to the listen-ports. Also, the securityGroups for Node/Pod will be modified to allow inbound traffic from this securityGroup.
-> 이 어노테이션이 없으면 컨트롤러는 자동으로 하나의 보안 그룹을 생성하고, 이 보안 그룹은 LoadBalancer에 연결되며, 인바운드-cidrs에서 listen-포트에 대한 액세스를 허용합니다. 또한 이 보안 그룹으로부터의 인바운드 트래픽을 허용하도록 노드/포드에 대한 보안 그룹이 수정됩니다.


If you specify this annotation, you need to configure the security groups on your Node/Pod to allow inbound traffic from the load balancer. You could also set the manage-backend-security-group-rules if you want the controller to manage the access rules.
-> 이 어노테이션을 지정하는 경우, 로드 밸런서에서 인바운드 트래픽을 허용하도록 노드/포드에서 보안 그룹을 구성해야 합니다. 컨트롤러가 액세스 규칙을 관리하도록 하려면 manage-backend-security-group-rules을 설정할 수도 있습니다.

 

alb.ingress.kubernetes.io/security-groups
바로 밑에 있는데 이걸 못보고 그냥 등록해버려서 생긴 문제였다.

alb.ingress.kubernetes.io/manage-backend-security-group-rules specifies whether you want the controller to configure security group rules on Node/Pod for traffic access when you specify security-groups.

This annotation applies only in case you specify the security groups via security-groups annotation. If set to true, controller attaches an additional shared backend security group to your load balancer. This backend security group is used in the Node/Pod security group rules.

 

aws eks와 ALB에서 보안그룹 작업중에 504 에러가 발생한다면
이 어노테이션을 확인해보시라...