ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • istio에서 north-south traffic의 의미
    Kubernetes 2025. 3. 12. 23:37
    728x90

    Istio에서 North-South Traffic(남북 트래픽)클러스터 외부와 내부 간에 흐르는 트래픽을 의미합니다.

    💡 쉽게 말해?

    • 외부에서 클러스터 내부로 들어오는 트래픽 (Inbound)
    • 클러스터 내부에서 외부로 나가는 트래픽 (Outbound)

     

    1️⃣ North-South Traffic의 주요 개념

    트래픽 방향 설명 예제
    North Traffic (Ingress, 들어오는 트래픽) 외부 클라이언트(사용자, API, 서비스)가 클러스터 내부의 애플리케이션에 요청을 보낼 때 발생 - 사용자가 브라우저에서 https://my-app.com 접속
    - 모바일 앱이 클러스터 내부의 API 서버에 요청
    South Traffic (Egress, 나가는 트래픽) 클러스터 내부의 서비스가 외부 API 또는 인터넷 리소스에 요청을 보낼 때 발생 - 내부 서비스가 외부 API(https://api.stripe.com)를 호출
    - Kubernetes Pod가 외부 데이터베이스와 통신

     

     

    2️⃣ North-South Traffic과 Istio 구성 요소

    Istio는 North-South 트래픽을 제어하기 위해 두 가지 주요 컴포넌트를 사용합니다.

    컴포넌트 역할 관련 리소스
    Ingress Gateway 외부 요청을 클러스터 내부로 라우팅 (North Traffic) Gateway, VirtualService
    Egress Gateway 내부 서비스가 외부로 나가는 트래픽을 제어 (South Traffic) ServiceEntry, VirtualService, Gateway

     

     

    3️⃣ North-South Traffic의 예제

    ✅ 1. North Traffic (Ingress Gateway) 예제

    외부 클라이언트가 Istio Ingress Gateway를 통해 내부 서비스에 접속하는 경우.

    📌 설정 예제 (Ingress Gateway + VirtualService)

    apiVersion: networking.istio.io/v1beta1
    kind: Gateway
    metadata:
      name: ingress-gateway
    spec:
      selector:
        istio: ingressgateway  # Istio Ingress Gateway 사용
      servers:
      - port:
          number: 443
          name: https
          protocol: HTTPS
        hosts:
        - my-app.com
        tls:
          mode: SIMPLE
          credentialName: my-app-cert  # TLS 인증서 설정

     

    apiVersion: networking.istio.io/v1beta1
    kind: VirtualService
    metadata:
      name: my-app
    spec:
      hosts:
      - my-app.com
      gateways:
      - ingress-gateway
      http:
      - route:
        - destination:
            host: my-app-service
            port:
              number: 80

     

    결과:

    • 사용자가 https://my-app.com에 접속하면 Ingress Gateway를 통해 내부 서비스로 요청이 전달됨.

     

    ✅ 2. South Traffic (Egress Gateway) 예제

    내부 서비스가 외부 API(https://api.stripe.com)를 호출하는 경우.

    📌 설정 예제 (Egress Gateway + ServiceEntry)

    apiVersion: networking.istio.io/v1beta1
    kind: ServiceEntry
    metadata:
      name: stripe-api
    spec:
      hosts:
      - api.stripe.com
      location: MESH_EXTERNAL
      ports:
      - number: 443
        name: https
        protocol: TLS
      resolution: DNS
    apiVersion: networking.istio.io/v1beta1
    kind: Gateway
    metadata:
      name: egress-gateway
    spec:
      selector:
        istio: egressgateway  # Istio Egress Gateway 사용
      servers:
      - port:
          number: 443
          name: https
          protocol: TLS
        hosts:
        - api.stripe.com
        tls:
          mode: PASSTHROUGH
    apiVersion: networking.istio.io/v1beta1
    kind: VirtualService
    metadata:
      name: stripe-egress
    spec:
      hosts:
      - api.stripe.com
      gateways:
      - egress-gateway
      tls:
      - match:
        - sniHosts:
          - api.stripe.com
        route:
        - destination:
            host: api.stripe.com
            port:
              number: 443

     

    결과:

     

    4️⃣ North-South Traffic vs East-West Traffic

    트래픽 유형설명예제관련 Istio 리소스

    North-South Traffic 클러스터 내부 ↔ 클러스터 외부 웹 브라우저 → Ingress Gateway → 내부 서비스 Ingress Gateway, Egress Gateway, ServiceEntry
    East-West Traffic 클러스터 내부에서 서비스 간 트래픽 frontend 서비스 → backend 서비스 VirtualService, DestinationRule, Sidecar Proxy

    🚀 즉, North-South는 클러스터와 외부 간의 트래픽, East-West는 클러스터 내부 서비스 간의 트래픽을 의미! 🚀

    728x90
Designed by Tistory.