Istio의 사이드카(Sidecar) 기반 아키텍처는 각 Pod 옆에 Envoy Proxy를 배치해 트래픽을 제어합니다.
이 패턴은 관찰성과 보안을 높이지만, 리소스 오버헤드가 있습니다.
이 글에서는 Terraform으로 AWS EKS 클러스터에 사이드카 모드 Istio를 설치하고, ALB Ingress Controller와 연동해 외부 트래픽을 받는 구조를 구성합니다.
설치 개요
| 컴포넌트 | 설명 |
|---|---|
istio-base |
Istio 공통 리소스 설치 (CRDs 등) |
istiod |
사이드카 기반 Istio 제어 플레인 |
istio-ingressgateway |
외부 진입점 게이트웨이 (NodePort로 배포) |
Gateway 리소스 |
Istio Gateway CR |
ALB용 Ingress 리소스 |
서비스/모니터링용 ALB Ingress 정의 |
Istio Sidecar와 ALB Ingress의 Terraform 리소스 관계
Istio Sidecar와 ALB Ingress의 Terraform 리소스 관계
그림 관계를 글로 읽기
- istiod는 istio-base에 의존한다.
- istio-ingress(gateway 차트, Service NodePort)는 istio-base와 istiod에 의존한다.
- Istio Gateway CR(istio-gateway.yaml)은 istio-base, istiod, istio-ingress에 의존한다.
- Services용 ALB Ingress는 앞의 네 리소스에 의존한다. 템플릿에 퍼블릭 서브넷과 ACM 인증서를 넘긴다.
- Addons용 ALB Ingress도 같은 네 리소스에 의존한다.
- Services용 Ingress 템플릿의 헬스체크 포트 값은 istio-ingressgateway Service 15021 포트의 node_port다.
- Addons용 Ingress 템플릿도 같은 값을 받는다.
1. istio-base 및 istiod 설치
hcl
resource "helm_release" "istio_base" {
namespace = "istio-system"
create_namespace = true
name = "istio-base"
repository = "https://istio-release.storage.googleapis.com/charts"
chart = "base"
upgrade_install = true
values = [
yamlencode({
defaultRevision = "default"
})
]
}
resource "helm_release" "istiod" {
namespace = "istio-system"
create_namespace = true
name = "istiod"
repository = "https://istio-release.storage.googleapis.com/charts"
chart = "istiod"
upgrade_install = true
depends_on = [ helm_release.istio_base ]
}
2. istio-ingressgateway 설치 (NodePort + ALB 연계 목적)
hcl
resource "helm_release" "istio_ingress" {
namespace = "istio-ingress"
create_namespace = true
name = "istio-ingress"
repository = "https://istio-release.storage.googleapis.com/charts"
chart = "gateway"
upgrade_install = true
values = [
yamlencode({
_internal_defaults_do_not_set = {
service = {
type = "NodePort"
}
}
extraManifests = []
})
]
depends_on = [ helm_release.istio_base, helm_release.istiod ]
}
3. Istio Gateway 리소스 정의
hcl
resource "kubectl_manifest" "istio_gateway" {
yaml_body = file("${path.module}/manifests/istio-gateway.yaml")
depends_on = [
helm_release.istio_base,
helm_release.istiod,
helm_release.istio_ingress
]
}
4. Ingress 리소스 (ALB 연동)
ALB와 연동되는 Ingress 템플릿 (Services용)
hcl
resource "kubectl_manifest" "ingress_for_services" {
yaml_body = templatefile("${path.module}/manifests/ingress-for-serivces.yaml", {
ALB_NAME_SVC = "${local.cluster_name}-svc-ingress"
PUBLIC_SUBNET_IDS = join(",", aws_subnet.public[*].id)
ACM_CERT_ARN = data.aws_acm_certificate.cert.arn
ISTIO_INGRESS_HEALTHCHECK_PORT = tostring([
for p in data.kubernetes_service.istio_ingressgateway.spec[0].port :
p.node_port if p.port == 15021
][0])
WAF_ACL_ARN = ""
})
depends_on = [
helm_release.istio_base,
helm_release.istiod,
helm_release.istio_ingress,
kubectl_manifest.istio_gateway
]
}
ALB와 연동되는 Ingress 템플릿 (Addons용)
hcl
resource "kubectl_manifest" "ingress_for_addons" {
yaml_body = templatefile("${path.module}/manifests/ingress-for-addons.yaml", {
ALB_NAME_ADDON = "${local.cluster_name}-addon-ingress"
PUBLIC_SUBNET_IDS = join(",", aws_subnet.public[*].id)
ACM_CERT_ARN = data.aws_acm_certificate.cert.arn
ISTIO_INGRESS_HEALTHCHECK_PORT = tostring([
for p in data.kubernetes_service.istio_ingressgateway.spec[0].port :
p.node_port if p.port == 15021
][0])
WAF_ACL_ARN = ""
})
depends_on = [
helm_release.istio_base,
helm_release.istiod,
helm_release.istio_ingress,
kubectl_manifest.istio_gateway
]
}
마무리
이 구성의 특징은 아래와 같습니다.
- Istio Sidecar Mesh 구조에서 트래픽 보안 및 관찰성 확보
- ALB Ingress Controller와 연동된 외부 진입점 확보
- 서비스와 모니터링용 인그레스 구성 분리
실제 운영에도 활용할 수 있는 Sidecar + ALB 아키텍처입니다.