Istio의 사이드카(Sidecar) 기반 아키텍처는 각 Pod 옆에 Envoy Proxy를 배치하여 트래픽을 제어합니다.

이 패턴은 관찰성과 보안을 향상시키지만, 리소스 오버헤드가 있는 구조입니다.

본 글에서는 Terraform을 이용해 AWS EKS 클러스터 상에 사이드카 모드 Istio를 설치하고, ALB Ingress Controller와 연동하여 외부 트래픽을 수용하는 구조를 구성합니다.


✅ 설치 개요

컴포넌트설명
istio-baseIstio 공통 리소스 설치 (CRDs 등)
istiod사이드카 기반 Istio 제어 플레인
istio-ingressgateway외부 진입점 게이트웨이 (NodePort로 배포)
Gateway 리소스Istio Gateway CR
ALB용 Ingress 리소스서비스/모니터링용 ALB Ingress 정의

1. istio-base 및 istiod 설치

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 연계 목적)

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 리소스 정의

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용)

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용)

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 아키텍처입니다.


🔗 참고 링크

profile
DevOps 엔지니어 / 열심히 해서 잘하자

0개의 댓글

Powered by GraphCDN, the GraphQL CDN