본문 바로가기
문서 목차
ORKESTRIX설치

Istio 서비스 메시

마이크로서비스(파드)들끼리 통신할 때 필요한 암호화, 재시도, 트래픽 분산, 통신 기록 같은 기능을 앱 코드 수정 없이 네트워크 계층에서 대신 처리해주는 서비스 메시입니다. Istio 를 사용합니다.

QUANTUM C&S

마이크로서비스(파드)들끼리 통신할 때 필요한 암호화, 재시도, 트래픽 분산, 통신 기록 같은 기능을 앱 코드 수정 없이 네트워크 계층에서 대신 처리해주는 서비스 메시입니다. Istio를 사용합니다.

설정값

inventory/qks/group_vars/all/all-k8s.yaml에서 아래 값을 확인 · 수정합니다:

qks_istio_enabled: true
qks_istio_version: 1.30.5
qks_istio_namespace: istio-system
qks_istio_nodeport_insecure: 31080   # HTTP
qks_istio_nodeport_secure: 31443     # HTTPS
qks_istio_nodeport_status: 31021     # 헬스체크 상태 포트

실행

./install.sh ubuntu plays/qks-istio.yaml
TLS 인증서는 클러스터 초기화 때(k8s.yaml) 이미 만들어진 인증서를 그대로 재사용합니다. (참고: paas.yaml 번들에도 포함되어 있지만, 그 번들을 실행하면 Istio 외에 cert-manager/Prometheus/PostgreSQL/Redis/OpenSearch/Knative/KServe/Milvus/Airflow 등 PaaS · AI/ML 계열 컴포넌트가 기본값에 따라 함께 설치됩니다. 위는 이 플레이북만 단독 실행하는 방법입니다.)

설치 흐름

./install.sh ubuntu plays/qks-istio.yaml 실행 시 아래 순서로 진행됩니다:

./install.sh ubuntu plays/qks-istio.yaml
  │
  ├─ 1. istio-system 네임스페이스 생성 + TLS Secret 생성
  ├─ 2. Helm 저장소 등록 (istio-release.storage.googleapis.com/charts)
  ├─ 3. istio-base 차트 배포        (CRD 등 공통 리소스)
  ├─ 4. istiod 차트 배포            (컨트롤 플레인 — 사이드카에 설정/인증서 배포)
  ├─ 5. istio-ingressgateway 배포  (외부 트래픽 진입점)
  ├─ 6. istio-cni 차트 배포         (전 노드에 DaemonSet으로 배포 — 파드 트래픽을 사이드카로 우회시키는 역할)
  ├─ 7. 관측성 애드온 배포          (Grafana/Loki/Prometheus/Jaeger/Zipkin/Kiali)
  └─ 8. 인그레스 게이트웨이 Service를 NodePort(31021/31080/31443)로 강제 지정
6단계(Istio CNI)는 모든 노드의 CNI 설정에 관여하는 컴포넌트입니다. 이 저장소에서 Multus CNI 옵션 검증 중 노드 네트워크 설정 충돌로 클러스터 전체 장애를 겪은 적이 있어 같은 위험군으로 분류하고 신중하게 접근했으나, 실제 검증 결과 CNI 충돌 없이 정상 동작함을 확인했습니다.

설치 확인

kubectl get pods -n istio-system -o wide
helm list -n istio-system
kubectl get svc -n istio-system istio-ingressgateway
  • istiod, istio-ingressgateway 파드가 Running
  • istio-cni-node가 전 노드 개수만큼(DaemonSet) Running
  • Helm 릴리즈 4개(istio-base/istio-istiod/istio-ingressgateway/istio-cni) 전부 deployed
  • 게이트웨이 Service 타입이 NodePort, 포트가 15021:31021, 80:31080, 443:31443으로 매핑됨

사이드카 자동 주입 확인

kubectl create namespace istio-demo
kubectl label namespace istio-demo istio-injection=enabled
kubectl run test-pod --image=nginx -n istio-demo
kubectl get pod test-pod -n istio-demo

READY가 2/2로 나오면(원래 컨테이너 1개뿐인 파드에 사이드카가 자동으로 추가된 것) 서비스 메시가 정상 동작하는 것입니다.

실제 라우팅 동작 확인

Istio는 표준 Ingress 대신 자체 CRD(Gateway, VirtualService)로 라우팅 규칙을 정의합니다:

# test-istio-gateway.yaml
apiVersion: v1
kind: Namespace
metadata:
  name: istio-demo
  labels:
    istio-injection: enabled
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-istio-app
  namespace: istio-demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test-istio-app
  template:
    metadata:
      labels:
        app: test-istio-app
    spec:
      containers:
        - name: web
          image: hashicorp/http-echo
          args:
            - "-text=hello-from-istio"
          ports:
            - containerPort: 5678
---
apiVersion: v1
kind: Service
metadata:
  name: test-istio-svc
  namespace: istio-demo
spec:
  selector:
    app: test-istio-app
  ports:
    - port: 80
      targetPort: 5678
---
apiVersion: networking.istio.io/v1
kind: Gateway
metadata:
  name: test-gateway
  namespace: istio-demo
spec:
  selector:
    istio: ingressgateway
  servers:
    - port:
        number: 80
        name: http
        protocol: HTTP
      hosts:
        - "test-istio.local"
---
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: test-vs
  namespace: istio-demo
spec:
  hosts:
    - "test-istio.local"
  gateways:
    - test-gateway
  http:
    - route:
        - destination:
            host: test-istio-svc
            port:
              number: 80
kubectl apply -f test-istio-gateway.yaml
kubectl get pods -n istio-demo   # test-istio-app이 2/2 Running 되면 진행

kubectl get nodes -o wide   # 아무 노드나 IP 확인
curl -H "Host: test-istio.local" http://<노드 IP>:31080/

hello-from-istio가 응답으로 나오면, 외부 요청 → Istio 게이트웨이 → VirtualService → Service → (사이드카 주입된) Pod까지 전체 경로가 정상 동작하는 것입니다.

확인 후 정리:

kubectl delete -f test-istio-gateway.yaml
kubectl delete namespace istio-demo

알려진 제약사항

Istio 전용 로드밸런서(qks_istio_load_balancer_enabled)는 기본적으로 꺼져 있습니다. 이 상태에서는 메인 로드밸런서(API서버/Traefik 담당)가 Istio 게이트웨이 트래픽은 처리하지 않으므로, 외부에서 접속하려면 워커 노드 IP로 NodePort(31080/31443)에 직접 접속해야 합니다 — 특정 노드로 트래픽이 고정되고, 그 노드가 죽으면 자동 우회되지 않습니다. 여러 마스터로 분산 · 자동 우회가 필요하면 qks_istio_load_balancer_enabled: true로 전용 HAProxy를 별도 활성화해야 합니다.

다음 단계