Files
mtusi2026lab7/infra/otel/README.md
T

21 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Конфигурация наблюдаемости (Lab 7 — mTLS + закрытый `otel-gateway`)
## Архитектура без plaintext-обходов
- `otel-gateway` (`haproxy:3.2-alpine`, `user: 99:99`, `read_only: true`, `cap_drop: [ALL]`) владеет сетевым пространством и DNS-алиасом `otel-collector` в `app_data` и `obs_net`.
- `:4318` (OTLP HTTP): обязательный mTLS + проверка CRL (`/run/certs/ca.crl`) + списки допустимых `CN` (`/run/certs/allowed-otlp-cn.lst`) и `SAN` (`/run/certs/allowed-otlp-san.lst`, только `DNS:messenger-api` и `DNS:messenger-worker`), `no-tls-tickets`, `tune.ssl.cachesize 0`.
- `:8888` (self-metrics): обязательный mTLS + CRL строго для `CN=prometheus`, `SAN=DNS:prometheus`.
- `:13133` (health): HTTPS с серверным сертификатом `otel-collector`.
- Конфигурация: `infra/otel/gateway.cfg`; живой reload CRL и allowlist-файлов по `SIGUSR2` без пересборки образа.
- `otel-collector` (`otel/opentelemetry-collector-contrib:0.128.0`, `network_mode: service:otel-gateway`) слушает исключительно loopback `127.0.0.1` (`:14318`, `:18888`, `:13134`), недоступный извне общего netns.
- `processors.memory_limiter` (`limit_mib: 204`, `spike_limit_mib: 40`) и `batch` + `sending_queue` обеспечивают backpressure без роста RSS.
- `processors.attributes/scrub` удаляет `Authorization`, `Cookie`, `X-Vault-Token`/`X-Bao-Token`, `password*`, `token*`, `secret_id`, `private_key`, `http.*.body` и `url.full` вторым рубежом поверх redaction приложения.
- Экспорт во все 3 хранилища идёт по нативному mTLS (`client.crt`/`client.key`, `CN=otel-collector`): Tempo (`tempo:4317`), Loki (`https://loki:3100/otlp`), Prometheus (`https://prometheus:9090/api/v1/otlp` + Basic Auth из `/run/secrets/otel_prometheus_password`).
## Хранилища и Grafana
- `infra/prometheus/prometheus.yml` + `infra/prometheus/web.yml` (шаблон): HTTPS + `RequireAndVerifyClientCert` + Basic Auth (`operator`, `grafana`, `otel-collector`, `prometheus-self`); все 6 scrape jobs (`prometheus`, `otel-collector`, `haproxy`, `rabbitmq`, `loki`, `tempo`) работают по HTTPS/mTLS.
- `infra/loki/loki.yaml`: нативный mTLS на `:3100` (`RequireAndVerifyClientCert`).
- `infra/tempo/tempo.yaml`: нативный mTLS на gRPC `:4317` и HTTPS `:3200`.
- `infra/grafana/provisioning/datasources/datasources.yaml`: HTTPS/mTLS с `$__file{/run/certs/...}` и `tlsSkipVerify: false`; UI Grafana слушает HTTPS на `127.0.0.1:3000` с выключенным анонимным доступом.