kt-event-marketing/design/backend/physical/network-prod-summary.md
jhbkjh 3075a5d49f 물리아키텍처 설계 완료
 주요 기능
- Azure 기반 물리아키텍처 설계 (개발환경/운영환경)
- 7개 마이크로서비스 물리 구조 설계
- 네트워크 아키텍처 다이어그램 작성 (Mermaid)
- 환경별 비교 분석 및 마스터 인덱스 문서

📁 생성 파일
- design/backend/physical/physical-architecture.md (마스터)
- design/backend/physical/physical-architecture-dev.md (개발환경)
- design/backend/physical/physical-architecture-prod.md (운영환경)
- design/backend/physical/*.mmd (4개 Mermaid 다이어그램)

🎯 핵심 성과
- 비용 최적화: 개발환경 월 $143, 운영환경 월 $2,860
- 확장성: 개발환경 100명 → 운영환경 10,000명 (100배)
- 가용성: 개발환경 95% → 운영환경 99.9%
- 보안: 다층 보안 아키텍처 (L1~L4)

🛠️ 기술 스택
- Azure Kubernetes Service (AKS)
- Azure Database for PostgreSQL Flexible
- Azure Cache for Redis Premium
- Azure Service Bus Premium
- Application Gateway + WAF

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 15:13:01 +09:00

354 lines
9.7 KiB
Markdown

# KT 이벤트 마케팅 서비스 - 운영환경 네트워크 아키텍처
## 📋 문서 정보
- **작성일**: 2025-10-29
- **환경**: Azure Production Environment
- **다이어그램**: network-prod.mmd
- **참조**: claude/sample-network-prod.mmd
## 🎯 아키텍처 개요
운영환경에 최적화된 고가용성 네트워크 아키텍처로, 다중 가용영역(Multi-Zone) 배포와 프라이빗 엔드포인트를 통한 보안 강화를 제공합니다.
### 핵심 특징
1. **고가용성**: 3개 가용영역(AZ)에 분산 배포
2. **보안 강화**: Private Endpoints 및 NSG 기반 네트워크 격리
3. **성능 최적화**: Redis Cluster, Read Replica, CDN 활용
4. **확장성**: HPA(Horizontal Pod Autoscaler) 기반 자동 스케일링
5. **모니터링**: Application Insights, Prometheus, Grafana 통합
## 🏗️ 네트워크 구성
### VNet 구조 (10.0.0.0/16)
```
VNet: 10.0.0.0/16
├── Gateway Subnet (10.0.4.0/24)
│ └── Application Gateway v2 + WAF
├── Application Subnet (10.0.1.0/24)
│ └── AKS Premium Cluster (Multi-Zone)
├── Database Subnet (10.0.2.0/24)
│ └── PostgreSQL Flexible Servers (7개)
├── Cache Subnet (10.0.3.0/24)
│ └── Azure Cache for Redis Premium
├── Service Subnet (10.0.5.0/24)
│ └── Azure Service Bus Premium
└── Management Subnet (10.0.6.0/24)
├── Monitoring (Log Analytics, App Insights, Prometheus, Grafana)
└── Security (Key Vault, Defender)
```
## 🔐 보안 아키텍처
### 1. 네트워크 보안
| 계층 | 보안 요소 | 설명 |
|------|----------|------|
| Edge | Azure Front Door + CDN | DDoS 보호, 글로벌 가속 |
| Gateway | Application Gateway + WAF v2 | OWASP CRS 3.2, Rate Limiting |
| Network | NSG (Network Security Groups) | 서브넷 간 트래픽 제어 |
| Data | Private Endpoints | 모든 백엔드 서비스 프라이빗 연결 |
| Access | Azure Key Vault Premium | 민감 정보 중앙 관리 |
| Monitoring | Azure Defender for Cloud | 실시간 위협 탐지 |
### 2. Private Endpoints
모든 백엔드 서비스는 Private Endpoints를 통해 VNet 내부에서만 접근 가능:
- PostgreSQL (7개 서비스별 DB)
- Redis Premium Cluster
- Service Bus Premium
- Key Vault Premium
### 3. Private DNS Zones
Private Link 서비스의 DNS 해석을 위한 전용 DNS 영역:
- `privatelink.postgres.database.azure.com`
- `privatelink.redis.cache.windows.net`
- `privatelink.servicebus.windows.net`
- `privatelink.vaultcore.azure.net`
## ⚙️ AKS 클러스터 구성
### Node Pool 구성
| Node Pool | VM Size | Nodes | Zone Distribution | 용도 |
|-----------|---------|-------|-------------------|------|
| System | Standard_D4s_v3 | 3 | AZ1, AZ2, AZ3 | K8s 시스템 컴포넌트 |
| Application | Standard_D8s_v3 | 5 | AZ1(2), AZ2(2), AZ3(1) | 애플리케이션 워크로드 |
### 마이크로서비스 구성
| 서비스 | Replicas | HPA 범위 | NodePort |
|--------|----------|----------|----------|
| User Service | 3 | 2-5 | 30080 |
| Event Service | 3 | 2-6 | 30081 |
| AI Service | 2 | 2-4 | 30082 |
| Content Service | 2 | 2-4 | 30083 |
| Distribution Service | 2 | 2-4 | 30084 |
| Participation Service | 3 | 2-5 | 30085 |
| Analytics Service | 2 | 2-4 | 30086 |
## 🗄️ 데이터베이스 아키텍처
### PostgreSQL Flexible Server (7개)
각 마이크로서비스는 독립적인 데이터베이스 사용:
| 서비스 | Database | 구성 | Backup |
|--------|----------|------|--------|
| User | user-db | Primary + Replica (Zone 1, 2) | Geo-redundant, 35일 |
| Event | event-db | Primary + Replica (Zone 1, 2) | Geo-redundant, 35일 |
| AI | ai-db | Primary + Replica (Zone 1, 2) | Geo-redundant, 35일 |
| Content | content-db | Primary + Replica (Zone 1, 2) | Geo-redundant, 35일 |
| Distribution | distribution-db | Primary + Replica (Zone 1, 2) | Geo-redundant, 35일 |
| Participation | participation-db | Primary + Replica (Zone 1, 2) | Geo-redundant, 35일 |
| Analytics | analytics-db | Primary + Replica (Zone 1, 2) | Geo-redundant, 35일 |
### 고가용성 전략
- **Primary-Replica 구성**: 각 DB는 Zone 1(Primary), Zone 2(Replica)에 배포
- **자동 백업**: Geo-redundant backup, 35일 보관
- **Point-in-time Recovery**: 최대 35일 내 복구 가능
- **Read Replica**: 읽기 부하 분산
## ⚡ 캐시 아키텍처
### Azure Cache for Redis Premium
- **구성**: Clustered, 6GB
- **노드**: Primary + 2 Replicas (3 Zones)
- **Shards**: 3개 샤드로 분산
- **HA**: Zone-redundant 고가용성
### 캐시 용도
- 세션 관리 (User Service)
- API 응답 캐싱 (Event Service)
- AI 결과 캐싱 (AI Service)
- 실시간 통계 (Analytics Service)
## 📨 메시지 큐 아키텍처
### Azure Service Bus Premium
- **Namespace**: sb-kt-event-prod
- **구성**: Zone-redundant
- **총 용량**: 128GB (Partitioned Queues)
### Queue 구성
| Queue | Size | Partitioned | 용도 |
|-------|------|-------------|------|
| ai-event-generation | 32GB | Yes | AI 이벤트 생성 비동기 처리 |
| content-generation | 32GB | Yes | 콘텐츠 생성 비동기 처리 |
| distribution | 32GB | Yes | 다채널 배포 비동기 처리 |
| notification | 16GB | Yes | 알림 발송 비동기 처리 |
| analytics | 16GB | Yes | 분석 데이터 수집 |
### 메시지 흐름
```
AI Queue → Content Queue → Distribution Queue → Notification Queue
Analytics Queue
```
## 📊 모니터링 & 관리
### Application Insights (7 instances)
각 마이크로서비스별 독립적인 Application Insights 인스턴스:
- 애플리케이션 성능 모니터링 (APM)
- 분산 추적 (Distributed Tracing)
- 실시간 메트릭 수집
- 로그 집계 및 분석
### Log Analytics Workspace
- 모든 Application Insights 데이터 집계
- 통합 쿼리 및 분석
- 알림 규칙 관리
### Prometheus + Grafana
- Kubernetes 클러스터 메트릭
- 컨테이너 리소스 사용량
- 커스텀 비즈니스 메트릭
- 실시간 대시보드
## 🚦 트래픽 흐름
### 1. 외부 → 내부
```
사용자
↓ HTTPS (TLS 1.3)
Azure Front Door + CDN
↓ Anycast
Application Gateway (Public IP)
↓ SSL Termination
WAF (OWASP CRS 3.2)
↓ Rate Limiting (200 req/min/IP)
Application Gateway (Private IP)
↓ Path-based Routing
AKS Internal Load Balancer
↓ ClusterIP
Microservices (Pods)
```
### 2. 서비스 → 데이터베이스
```
Microservices
↓ Private Link (TCP:5432)
PostgreSQL Private Endpoint
↓ DNS Resolution (Private DNS Zone)
PostgreSQL Primary/Replica
```
### 3. 서비스 → 캐시
```
Microservices
↓ Private Link (TCP:6379)
Redis Private Endpoint
↓ DNS Resolution (Private DNS Zone)
Redis Primary + Replicas
```
### 4. 서비스 → 메시지 큐
```
Microservices
↓ Private Link (AMQP)
Service Bus Private Endpoint
↓ DNS Resolution (Private DNS Zone)
Service Bus Queues
```
## 🔧 운영 고려사항
### 1. 스케일링 전략
**Horizontal Pod Autoscaler (HPA)**
- CPU 사용률 70% 이상 시 자동 스케일 아웃
- 메모리 사용률 80% 이상 시 자동 스케일 아웃
- 최소/최대 Replica 수 설정
**Node Pool Auto-scaling**
- Application Node Pool: 5-15 노드
- Zone별 균등 분산 유지
### 2. 백업 및 복구
**데이터베이스 백업**
- 자동 백업: 매일 1회
- 보관 기간: 35일
- Geo-redundant 저장소
- Point-in-time Recovery 지원
**클러스터 백업**
- AKS 클러스터 구성 백업
- ConfigMaps 및 Secrets 백업
- Persistent Volume 스냅샷
### 3. 재해 복구 (DR)
**RTO/RPO 목표**
- RTO (Recovery Time Objective): 1시간
- RPO (Recovery Point Objective): 15분
**DR 전략**
- Multi-Zone 배포로 Zone 장애 대응
- Geo-redundant 백업으로 Region 장애 대응
- 자동 장애 조치 (Automatic Failover)
### 4. 보안 운영
**정기 점검 항목**
- [ ] NSG 규칙 검토 (월 1회)
- [ ] WAF 정책 업데이트 (분기 1회)
- [ ] Key Vault 접근 로그 검토 (주 1회)
- [ ] Defender 알림 모니터링 (실시간)
- [ ] 취약점 스캔 (월 1회)
**인증서 관리**
- SSL/TLS 인증서: 90일 전 갱신 알림
- Key Vault 키 로테이션: 연 1회
- 서비스 주체 시크릿: 180일 전 갱신
## 📈 성능 최적화
### 1. 네트워크 성능
**Application Gateway**
- WAF 규칙 최적화 (불필요한 규칙 비활성화)
- 연결 드레이닝 설정 (30초)
- 백엔드 헬스 체크 간격 최적화
**AKS 네트워킹**
- Azure CNI 사용 (빠른 Pod 네트워킹)
- Calico 네트워크 정책 적용
- Service Mesh (Istio) 선택적 사용
### 2. 데이터베이스 성능
**쿼리 최적화**
- Read Replica 활용 (읽기 부하 분산)
- 연결 풀링 (HikariCP 최적화)
- 인덱스 전략 수립
**리소스 튜닝**
- 적절한 vCore 및 메모리 할당
- IOPS 모니터링 및 조정
- 쿼리 성능 분석 (pg_stat_statements)
### 3. 캐시 성능
**Redis 최적화**
- 적절한 TTL 설정
- 캐시 히트율 모니터링 (목표: 95% 이상)
- 메모리 정책: allkeys-lru
## 🔗 관련 문서
- [High-Level 아키텍처](../high-level-architecture.md)
- [유저스토리](../../userstory.md)
- [API 설계](../api/)
- [데이터베이스 설계](../database/)
## 📝 변경 이력
| 날짜 | 버전 | 변경 내용 | 작성자 |
|------|------|----------|--------|
| 2025-10-29 | 1.0 | 최초 작성 | System Architect |
## ✅ 검증 체크리스트
- [x] 29개 subgraph와 29개 end 문 균형 확인
- [x] 7개 마이크로서비스 반영
- [x] Multi-Zone (3 AZs) 구성
- [x] Private Endpoints 모든 백엔드 서비스 적용
- [x] NSG 규칙 서브넷 간 적용
- [x] 모니터링 및 보안 서비스 통합
- [x] High Availability 구성 (Primary + Replica)
- [ ] Mermaid 문법 검증 (Docker 컨테이너 필요)