diff --git a/.gitignore b/.gitignore index 7a60b85..b7474d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ __pycache__/ *.pyc + +# 로컬 테스트 산출물 (커밋 금지) — 멀티테넌시 격리 검증 스크립트·문서·결과 +/tenant-verification/ diff --git a/doc/monitoring-deploy-guide.md b/doc/monitoring-deploy-guide.md index e406921..6d31289 100644 --- a/doc/monitoring-deploy-guide.md +++ b/doc/monitoring-deploy-guide.md @@ -69,10 +69,21 @@ ArgoCD가 동기화를 시작하기 **전에** 반드시 준비되어야 한다. ### 1.4 relabel ConfigMap -vmagent base custom-values가 `vmagent-relabel-configs` ConfigMap을 마운트한다(테넌트별 키: `demo01.yaml` / `demo02.yaml` / `platform.yaml`). +vmagent base custom-values가 `vmagent-relabel-configs` ConfigMap을 마운트한다(테넌트별 키: `demo01.yaml` / `demo02.yaml` / `platform.yaml`). 각 키는 해당 remoteWrite URL(`/insert/{accountID}/`)의 `urlRelabelConfig`로, 그 accountID에 **남길 시계열만 keep** 하는 규칙이다. -- 초기 배포 시엔 빈 규칙(`[]`)으로도 기동 가능. -- 테넌트별 keep 필터 채우기는 **§3(배포 후 테넌트 관리)** 에서 다룬다. dip-console이 테넌트 온보딩 시 갱신. +- 초기 배포 시 빈 규칙(`[]`)으로 **기동은 가능**하나, ⚠️ **`[]`는 격리가 아니다** — keep 규칙이 없으면 vmagent가 스크레이프한 **모든 메트릭이 모든 accountID에 그대로 기록**되어 테넌트 간 데이터가 섞인다(격리 미적용). 실제 dev 검증에서 `[]` 상태의 acct1·acct2가 서로의 namespace 메트릭을 모두 보유함을 확인했다. +- 실제 격리는 namespace 기준 keep 필터로 채운다(dip-console이 테넌트 온보딩 시 생성). 예: + ```yaml + # demo01.yaml (accountID 1 — demo01-* 만 남김) + - action: keep + source_labels: [namespace] + regex: "demo01-.*" + # platform.yaml (accountID 9000 — demo 테넌트 제외한 나머지) + - action: drop + source_labels: [namespace] + regex: "(demo01|demo02)-.*" + ``` +- 상세 규칙·검증은 **§3(배포 후 테넌트 관리)** 및 [배포 테스트 기록 #2](https://github.com/paasup/dip-catalog/issues/2) 참조. ### 1.5 값(values) repo diff --git a/manifests/helm/opentelemetry-collector/0.156.2/custom-values-events.yaml b/manifests/helm/opentelemetry-collector/0.156.2/custom-values-events.yaml index 4e98426..52d699a 100644 --- a/manifests/helm/opentelemetry-collector/0.156.2/custom-values-events.yaml +++ b/manifests/helm/opentelemetry-collector/0.156.2/custom-values-events.yaml @@ -49,7 +49,8 @@ config: tls: insecure: true headers: - VictoriaLogs-AccountID: "0" + AccountID: "0" + ProjectID: "0" service: pipelines: diff --git a/manifests/helm/opentelemetry-collector/0.156.2/custom-values.yaml b/manifests/helm/opentelemetry-collector/0.156.2/custom-values.yaml index f94bb2a..56258cb 100644 --- a/manifests/helm/opentelemetry-collector/0.156.2/custom-values.yaml +++ b/manifests/helm/opentelemetry-collector/0.156.2/custom-values.yaml @@ -136,24 +136,29 @@ config: - 'IsMatch(attributes["namespace"], "^(demo01|demo02)-.*")' exporters: + # VictoriaLogs 멀티테넌시 헤더는 AccountID/ProjectID 다. (VictoriaLogs-AccountID는 + # 인식되지 않아 전량 account 0 으로 적재됨 — dev 실측으로 확인. docs/victorialogs #multitenancy) otlphttp/vlogs-0: endpoint: "http://vlogs-victoria-logs-cluster-vlinsert.monitoring.svc.cluster.local:9481/insert/opentelemetry" tls: insecure: true headers: - VictoriaLogs-AccountID: "0" + AccountID: "0" + ProjectID: "0" otlphttp/vlogs-1: endpoint: "http://vlogs-victoria-logs-cluster-vlinsert.monitoring.svc.cluster.local:9481/insert/opentelemetry" tls: insecure: true headers: - VictoriaLogs-AccountID: "1" + AccountID: "1" + ProjectID: "0" otlphttp/vlogs-2: endpoint: "http://vlogs-victoria-logs-cluster-vlinsert.monitoring.svc.cluster.local:9481/insert/opentelemetry" tls: insecure: true headers: - VictoriaLogs-AccountID: "2" + AccountID: "2" + ProjectID: "0" service: pipelines: diff --git a/manifests/helm/victoria-metrics-agent/0.40.0/CUSTOM-README.md b/manifests/helm/victoria-metrics-agent/0.40.0/CUSTOM-README.md index 9236c1b..6fbb727 100644 --- a/manifests/helm/victoria-metrics-agent/0.40.0/CUSTOM-README.md +++ b/manifests/helm/victoria-metrics-agent/0.40.0/CUSTOM-README.md @@ -13,7 +13,20 @@ kubectl create configmap vmagent-relabel-configs -n monitoring \ --from-file=demo01.yaml --from-file=demo02.yaml --from-file=platform.yaml ``` -각 파일은 `write_relabel_configs` 규칙(예: 특정 namespace만 통과)을 담는다. 테넌트별 격리가 필요 없으면 fallback(accountID 0) remoteWrite 하나만 남겨도 된다. +각 파일은 `write_relabel_configs` 규칙을 담는다. 해당 accountID에 **남길 시계열만 keep**(또는 특정 테넌트를 drop)하는 규칙이다. 예: + +```yaml +# demo01.yaml — accountID 1: demo01-* namespace 메트릭만 남김 +- action: keep + source_labels: [namespace] + regex: "demo01-.*" +# platform.yaml — accountID 9000: demo 테넌트 제외한 나머지 +- action: drop + source_labels: [namespace] + regex: "(demo01|demo02)-.*" +``` + +> ⚠️ **빈 규칙(`[]`)은 격리가 아니다.** keep 규칙이 없으면 스크레이프한 모든 메트릭이 그 accountID에 기록된다 → 여러 URL에 `[]`를 두면 모든 테넌트가 서로의 메트릭을 보게 된다. 격리하려면 위처럼 namespace 기준 keep/drop 규칙을 반드시 채운다. 테넌트별 격리가 필요 없으면 fallback(accountID 0) remoteWrite 하나만 남겨도 된다. ```sh helm upgrade vmagent ./ -f custom-values.yaml --install -n monitoring