
AdministratorAccess 권한 부여가 필요하다 (실습 완료후에 해당 권한 삭제 진행)
출처 : AEWS 3기 스터디


여러 클러스터로 분산된 마이크로서비스 간 통신을 위해선 먼저 어디에 어떤 서비스가 있는지 알아야 합니다.
클라이언트 사이드 패턴

서버 사이드 패턴



| 구분 | Ingress | Service Mesh |
|---|---|---|
| 지원 프로토콜 | 주로 HTTP/HTTPS (L7) | 주로 내부 동-서 트래픽 |
| 비표준 확장 | 벤더마다 어노테이션 필요 | 멀티 VPC·클러스터 환경에서 프록시 남발 |
| 외부 트래픽 처리 | 제한적 (gRPC, TCP, UDP 어려움) | 북-남(External→Internal) 기능 부족 |
| 운영 복잡도 | 단순하지만 기능 한계 | 사이드카 배포·관리 오버헤드 |
기존 Ingress와 Service Mesh의 한계(비표준 확장, 프로토콜 제약, 멀티 클러스터 복잡도 등)를 넘어서기 위해, SIG-NETWORK 커뮤니티에서는 Gateway API를 고안했습니다. Gateway API는 역할 기반의 명확한 책임 분리, L7/L4를 아우르는 범용적 프로토콜 지원, Kubernetes 네이티브 표준화, 그리고 멀티 클러스터·VPC 통합을 주요 목표로 설계되었습니다.


출처 : AEWS 3기 스터디
현대적인 애플리케이션은 점점 더 마이크로서비스 아키텍처로 진화하고 있습니다. 다양한 컴퓨팅 환경과 VPC에 흩어진 서비스들을 어떻게 효율적으로 연결하고 보호할 수 있을까요?
이러한 고민을 해결하기 위해 AWS는 Amazon VPC Lattice 를 출시했습니다. 이 글에서는 VPC Lattice의 개념과 핵심 구성 요소들을 살펴봅니다.
Amazon VPC Lattice는 EC2, EKS, Lambda 등 다양한 컴퓨팅 리소스 간에 통합된 애플리케이션 네트워킹 기능을 제공하는 완전관리형 서비스입니다. 단일 VPC는 물론, 여러 계정 및 리전 간의 서비스 연결, 보호, 모니터링을 단일 프레임워크로 통합할 수 있다는 것이 가장 큰 특징입니다.

VPC Lattice는 네 가지 주요 컴포넌트로 구성되어 있습니다.

Service는 EC2, Lambda, EKS 등에서 동작하는 애플리케이션 단위입니다. 리스너를 통해 클라이언트 요청을 받고, 대상 그룹(Target Group)으로 라우팅합니다.
고유한 도메인을 가지며 상태 확인(Health check)을 통해 안정적인 트래픽 처리가 가능합니다.

Service Network는 여러 서비스를 논리적으로 묶고, 해당 네트워크 안에서 트래픽 흐름을 제어할 수 있게 합니다. VPC 연결을 통해 접근 권한을 제어할 수 있습니다.

IAM 기반의 접근 제어 정책으로, 서비스에 접근 가능한 주체를 세부적으로 설정할 수 있습니다.

Service Directory는 조직 내 VPC Lattice 서비스를 한 눈에 확인하고 검색할 수 있는 카탈로그입니다.




AWS Gateway API Controller는 Kubernetes의 Gateway API 리소스를 감시하여, 이를 기반으로 Amazon VPC Lattice 리소스를 자동으로 생성/연결하는 오픈소스 컨트롤러입니다.
즉, 사용자는 별도의 사이드카 프록시 없이도 쿠버네티스 네이티브 방식으로 VPC Lattice를 구성할 수 있게 됩니다.

| Gateway API 리소스 | VPC Lattice 리소스 |
|---|---|
GatewayClass | VPC Lattice Controller 구성 방식 |
Gateway | VPC Lattice Service Network |
HTTPRoute / GRPCRoute | VPC Lattice Service 및 Route 규칙 |
BackendRef | Target Group (ECS, EKS, Lambda 등 대상 그룹 매핑) |
이러한 매핑을 통해, 클러스터 내 리소스를 선언적으로 정의하면 VPC Lattice 리소스가 자동으로 프로비저닝됩니다.
AWS Gateway API Controller는 다음과 같은 기능을 제공합니다:
kubectl 또는 Helm을 통해 설치 가능
해당 실습에선 클라이언트 애플리케이션과 서버 애플리케이션을 서로 다른 VPC에 배포하고, 이들 간 통신을 Amazon VPC Lattice를 통해 연결하는 방법을 설명합니다. 특히 Terraform을 사용해 모든 리소스를 코드 기반으로 자동화하며, Route 53 + ExternalDNS를 활용해 사용자 지정 도메인까지 구성합니다.
git clone https://github.com/aws-ia/terraform-aws-eks-blueprints.gitcd terraform-aws-eks-blueprints/patterns/vpc-lattice/client-server-communicationap-northeast-2 으로 변경 (line 29)locals {
name = basename(path.cwd)
region = "ap-northeast-2" # 해당 정보 변경
cluster_vpc_cidr = "10.0.0.0/16"
client_vpc_cidr = "10.1.0.0/16"
azs = slice(data.aws_availability_zones.available.names, 0, 3)
tags = {
Blueprint = local.name
GithubRepo = "github.com/aws-ia/terraform-aws-eks-blueprints"
}
}terraform initterraform apply -target="module.client_vpc" -auto-approve
terraform apply -target="module.cluster_vpc" -auto-approve
terraform apply -target=aws_route53_zone.primary -auto-approve
terraform apply -target="module.client_sg" -auto-approve
terraform apply -target="module.endpoint_sg" -auto-approve
terraform apply -target="module.client" -auto-approve
terraform apply -target="module.vpc_endpoints" -auto-approve
terraform apply -target="module.eks" -auto-approve
terraform apply -target="module.addons" -auto-approve
terraform apply -auto-approveaws eks update-kubeconfig --name client-server-communication --alias client-server-communication --region ap-northeast-2kubectl get pod -A 







kubectl logs -f deployment/server -n apps --all-containers=true --since=1mcurl -i http://server.example.com 

nslookup server.example.com 




kubectl logs deployment/aws-gateway-api-controller-aws-gateway-controller-chart -n aws-application-networking-system --all-containers=true > lattice.log
terraform destroy -target="module.client_vpc" -auto-approve
terraform destroy -target="module.cluster_vpc" -auto-approve
terraform destroy -target=aws_route53_zone.primary -auto-approve
terraform destroy -target="module.client_sg" -auto-approve
terraform destroy -target="module.endpoint_sg" -auto-approve
terraform destroy -target="module.client" -auto-approve
terraform destroy -target="module.vpc_endpoints" -auto-approve
terraform destroy -target="module.eks" -auto-approve
terraform destroy -target="module.addons" -auto-approve
terraform destroy -auto-approve
이번에는 멀티 클러스터 환경 간에서 Amazon VPC Lattice를 활용한 안전한 통신 방법에 대해 실습을 진행합니다.

출처 : AWES Study 3기
| 범주 | 구성 요소 | 역할 |
|---|---|---|
| 인프라 | VPC Lattice | 중앙 집중형 서비스 라우터 |
| VPC-Cluster1, VPC-Cluster2 | 각각 겹치는 CIDR로 구성된 분리된 VPC | |
| 클러스터 | EKS Cluster1, EKS Cluster2 | 각 VPC에 배포된 쿠버네티스 클러스터 |
| 보안 & 인증 | ACM + AWS Private CA | *.example.com TLS 인증서 관리 및 발급 |
| IAM Auth Policy | 클러스터 간 호출 권한 제어 | |
| Envoy SigV4 Proxy (Kyverno 사이드카) | IAM 서명된 요청만 허용하는 사이드카 프록시 | |
| DNS & SD | Amazon Route 53 Private Hosted Zone | 사설 DNS 존, Lattice 서비스와 결합 |
| ExternalDNS | Kubernetes Service → DNS 레코드 자동 생성 |
클라이언트 요청
사용자는 https://demo-cluster1.example.com 으로 요청을 전송합니다.
VPC Lattice 접수
VPC Lattice가 요청을 받아 내부적으로 EKS Cluster1의 Envoy Proxy로 라우팅합니다.
Envoy SigV4 인증
Proxy 컨테이너는 IAM 자격 증명을 사용해 SigV4로 요청에 서명하고, TLS 터널을 설정합니다.
앱 처리
App1 Pod가 비즈니스 로직을 수행 후 응답을 반환합니다.
클러스터 간 호출
필요 시 Envoy를 통해 Cluster2의 서비스 (demo-cluster2.example.com)로 동일한 방식으로 재연결 가능합니다.
DNS 자동 관리
ExternalDNS가 Kubernetes Service 리소스를 감지해 Route 53에 레코드를 자동으로 등록·갱신합니다.

출처 : AEWS 스터디 3기
cd terraform-aws-eks-blueprints/patterns/vpc-lattice/cross-cluster-pod-communication/environment/ap-northeast-2 으로 변경 (line 7)locals {
name = "vpc-lattice"
region = "ap-northeast-2" ## 해당 부분 변경
domain = var.custom_domain_name
tags = {
Blueprint = local.name
GithubRepo = "github.com/aws-ia/terraform-aws-eks-blueprints"
}
}terraform init
terraform apply --auto-approvecd ../cluster/ap-northeast-2 으로 변경 (line 31)locals {
name = "eks-${terraform.workspace}"
region = "ap-northeast-2". # 해당 부분 변경
cluster_vpc_cidr = "10.0.0.0/16"
azs = slice(data.aws_availability_zones.available.names, 0, 3)
domain = data.terraform_remote_state.environment.outputs.custom_domain_name
certificate_arn = data.terraform_remote_state.environment.outputs.aws_acm_cert_arn
acmpca_arn = data.terraform_remote_state.environment.outputs.aws_acmpca_cert_authority_arn
custom_domain = data.terraform_remote_state.environment.outputs.custom_domain_name
app_namespace = "apps"./deploy.sh cluster1
# 배포 완료 후, 아래 명령으로 kubectl config 설정을 완료합니다.
≈./deploy.sh cluster2
# 배포 완료 후, 아래 명령으로 kubectl config 설정을 완료합니다.
eval `terraform output -raw configure_kubectl`





# cluster 1 전환
kubectl config use-context eks-cluster1
# pod 조회
kubectl get po -A 
# cluster 2 전환
kubectl config use-context eks-cluster2
# pod 조회
kubectl get po -A 
kubectl --context eks-cluster1 \
exec -ti -n apps deployments/demo-cluster1-v1 -c demo-cluster1-v1 \
-- curl demo-cluster2.example.com
kubectl --context eks-cluster1 \
exec -ti -n apps deployments/demo-cluster1-v1 -c demo-cluster1-v1 \
-- curl demo-cluster1.example.comAcceptDeniendException 발생. 
kubectl --context eks-cluster1 \
get IAMAuthPolicy -n apps demo-cluster1-iam-auth-policy \
-o json | jq ".spec.policy | fromjson" 
kubectl describe IAMAuthPolicy demo-cluster1-iam-auth-policy -n apps 
0이 아닌 1000으로 지정해, 관리자 권한 프로세스(예: kube-proxy)에 적용되지 않도록 함REDIRECT 규칙 삽입이 과정을 통해 데모 애플리케이션 Pod는 Kyverno로 자동조작(mutating)되어, 애플리케이션 → Envoy → VPC Lattice 경로를 투명하게 보호할 수 있게 됩니다.
cd ./patterns/vpc-lattice/cross-cluster-pod-communication/cluster/
./destroy.sh cluster2
./destroy.sh cluster1