# OpenTelemetry Collector 배포 (로그 + 이벤트 수집) 두 가지 모드로 배포한다. - **DaemonSet (`otelcol`)** — 모든 노드의 파드 로그 수집 → `custom-values.yaml` - **Deployment (`otelcol-events`)** — K8s 이벤트 수집 (단일 인스턴스) → `custom-values-events.yaml` ## 1. 배포 방법 ```sh # 파드 로그 (DaemonSet) helm upgrade otelcol open-telemetry/opentelemetry-collector \ -f custom-values.yaml --install -n monitoring # K8s 이벤트 (Deployment) — 동일 차트, 다른 values helm upgrade otelcol-events open-telemetry/opentelemetry-collector \ -f custom-values-events.yaml --install -n monitoring ``` > 이미지는 `otel/opentelemetry-collector-contrib`를 사용한다(filelog/k8sobjects 등 contrib 컴포넌트 필요). ## 2. custom-values.yaml (DaemonSet) 설정 설명 ### 파이프라인 | 파이프라인 | 흐름 | 대상 | |-----------|------|------| | logs/demo01 | filelog → filter(namespace=demo01-*) | vlinsert AccountID 1 | | logs/demo02 | filelog → filter(namespace=demo02-*) | vlinsert AccountID 2 | | logs/platform | filelog → filter(나머지) | vlinsert AccountID 0 | - **로그 테넌시**: `VictoriaLogs-AccountID` 헤더로 vlinsert에 격리 전송. namespace는 filelog regex가 log record attribute에 추출하므로 OTTL `attributes["namespace"]`로 필터한다. - **호스트 로그 마운트**: `/var/log/pods`, `/var/lib/docker/containers` (readOnly). - **RBAC**: k8sattributes 프로세서용 pods/namespaces/nodes/replicasets 권한. ## 3. custom-values-events.yaml (Deployment) 설정 설명 `k8sobjects` receiver로 K8s 이벤트를 watch하여 vlinsert(AccountID 0)로 전송한다. 이벤트 중복 방지를 위해 **단일 replica**로 운영한다. ## 4. 의존 관계 - **로그 전송 대상**: vlogs vlinsert:9481 ## 5. 검증 ```sh kubectl get pods -n monitoring -l app.kubernetes.io/instance=otelcol kubectl logs -n monitoring ds/otelcol-opentelemetry-collector | grep -i 'started\|error' | head ```