서비스 메시: Istio
마이크로서비스 간 통신을 제어하고 보안, 관측성을 제공하는 인프라 레이어
마이크로서비스 간 통신을 제어하고 보안, 관측성을 제공하는 인프라 레이어
목표: 서비스 메시를 구축하고 트래픽 관리, 보안, 모니터링을 구현할 수 있는 수준
🌐 서비스 메시 개념
아키텍처
graph TB
subgraph "서비스 메시"
APP1["📦 App A"] ---|"mTLS"| PROXY1["🛡️ Envoy Sidecar"]
APP2["📦 App B"] ---|"mTLS"| PROXY2["🛡️ Envoy Sidecar"]
APP3["📦 App C"] ---|"mTLS"| PROXY3["🛡️ Envoy Sidecar"]
PROXY1 ---|"mTLS"| PROXY2
PROXY2 ---|"mTLS"| PROXY3
end
subgraph "제어 평면"
ISTIOD["🎛️ istiod"] -->|"설정"| PROXY1
ISTIOD -->|"설정"| PROXY2
ISTIOD -->|"설정"| PROXY3
end
핵심 기능:
- 트래픽 관리: 라우팅, 로드밸런싱, 치명적 공격
- 보안: mTLS, 인증, 인가
- 관측성: 메트릭, 로그, 추적
🚀 Istio 설치
설치
# Istioctl 설치
curl -L https://istio.io/downloadIstio | sh -
cd istio-*
sudo cp bin/istioctl /usr/local/bin/
# 설치 (demo 프로파일)
istioctl install --set profile=demo -y
# 네임스페이스 레이블링
kubectl label namespace default istio-injection=enabled
# 확인
kubectl get pods -n istio-system
프로파일
| 프로파일 | 사용처 |
|---|---|
| default | 프로덕션 |
| demo | 평가/테스트 |
| minimal | 최소 설치 |
| preview | 미리보기 기능 |
| empty | 커스텀 설치 |
🎯 트래픽 관리
VirtualService
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: my-app
spec:
hosts:
- my-app
http:
- match:
- headers:
canary:
exact: "true"
route:
- destination:
host: my-app
subset: v2
weight: 100
- route:
- destination:
host: my-app
subset: v1
weight: 90
- destination:
host: my-app
subset: v2
weight: 10
DestinationRule
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: my-app
spec:
host: my-app
trafficPolicy:
connectionPool:
tcp:
maxConnections: 100
http:
http1MaxPendingRequests: 50
maxRequestsPerConnection: 10
outlierDetection:
consecutiveErrors: 5
interval: 30s
baseEjectionTime: 30s
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
Gateway
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: my-gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*.example.com"
- port:
number: 443
name: https
protocol: HTTPS
tls:
mode: SIMPLE
credentialName: my-cert
hosts:
- "*.example.com"
🔐 보안
mTLS
apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
name: default
namespace: default
spec:
mtls:
mode: STRICT # PERMISSIVE, DISABLE
AuthorizationPolicy
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
name: my-app-policy
namespace: default
spec:
selector:
matchLabels:
app: my-app
action: ALLOW
rules:
- from:
- source:
principals: ["cluster.local/ns/default/sa/frontend"]
to:
- operation:
methods: ["GET"]
paths: ["/api/*"]
- from:
- source:
namespaces: ["admin"]
to:
- operation:
methods: ["*"]
RequestAuthentication
apiVersion: security.istio.io/v1beta1
kind: RequestAuthentication
metadata:
name: jwt-auth
namespace: default
spec:
selector:
matchLabels:
app: my-app
jwtRules:
- issuer: "https://auth.example.com"
jwksUri: "https://auth.example.com/.well-known/jwks.json"
audiences:
- "my-app"
📊 관측성
Kiali
# Kiali 설치
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.18/samples/addons/kiali.yaml
# 접근
istioctl dashboard kiali
Grafana
# Grafana 설치
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.18/samples/addons/grafana.yaml
# 접근
istioctl dashboard grafana
Jaeger
# Jaeger 설치
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.18/samples/addons/jaeger.yaml
# 접근
istioctl dashboard jaeger
📋 체크리스트
- Istio 설치
- 사이드카 주입
- VirtualService 작성
- DestinationRule 작성
- Gateway 설정
- mTLS 활성화
- AuthorizationPolicy 작성
- JWT 인증 설정
- Kiali/Grafana/Jaeger 설치
- 트래픽 분할 테스트
🔗 관련 노트
- 03-07-분산추적 — 분산 추적
- 03-05-모니터링-Prometheus-Grafana — 메트릭 모니터링
- 02-04-NetworkPolicy — 네트워크 보안
마지막 업데이트: 2026-06-01