@bluedynamics/cdk8s-monitoring

中文文档
1.13.0发布于 2026/11/05Apache-2.0TypeScriptCommonJS构建来源已验证近 30 天下载 3061

Generic cdk8s monitoring stack (Prometheus, Thanos, Loki, Grafana, Alloy) for Kubernetes

原始使用文档
文档目录7 节
  1. Features
  2. Install
  3. Usage
  4. Documentation
  5. Prerequisites
  6. Development
  7. License

@bluedynamics/cdk8s-monitoring

npm Documentation

A generic cdk8s construct library for a complete Kubernetes monitoring stack: Prometheus, Thanos, Loki, Grafana, Alloy, and optionally Tempo, with long-term storage on S3-compatible object storage.

Full documentation: https://bluedynamics.github.io/cdk8s-monitoring/**

The library is application-agnostic. It synthesizes the stack itself; your own dashboards and alert rules live in your integration chart and attach beside the stack (the Grafana sidecar discovers ConfigMaps labeled grafana_dashboard: "1").

Features

  • Prometheus + Alertmanager + Grafana via the kube-prometheus-stack Helm chart.
  • Thanos Query, Store, and Compactor for long-term metrics with downsampling.
  • Loki + Alloy for log aggregation and collection.
  • Optional Tempo tracing behind a tail-sampling Alloy gateway.
  • Email alerting with curated defaults: noise-free routing, CronJob and PodDisruptionBudget health rules, optional staging demotion.
  • Optional Traefik and Longhorn monitors, optional Grafana iframe embedding.
  • S3 buckets and credentials wired through Crossplane and External Secrets Operator.
  • ArgoCD sync-wave ordering baked in.
  • Sensible production defaults you override only where needed (deep-merge).

Install

npm install @bluedynamics/cdk8s-monitoring

Peer dependencies: cdk8s, cdk8s-plus-33, constructs.

Usage

Provide your cluster-specific values and let mergeConfig fill in the defaults:

import { App } from 'cdk8s';
import { MonitoringChart, mergeConfig } from '@bluedynamics/cdk8s-monitoring';

const app = new App();

const config = mergeConfig({
  namespace: 'monitoring',
  clusterName: 'example',
  domains: { grafana: 'grafana.example.com' },
  s3: {
    endpoint: 'https://s3.example.com',
    endpointNoProtocol: 's3.example.com',
    region: 'eu',
    buckets: { thanos: 'metrics-thanos', loki: 'logs-loki' },
  },
  smtp: { host: 'mail.example.com', port: 587, from: '[email protected]', requireTls: true },
  integrations: {
    s3ProviderConfig: 'my-s3-provider',          // Crossplane ProviderConfig (buckets)
    s3SecretStore: 'my-s3-secret-store',         // ESO ClusterSecretStore (S3 credentials)
    s3CredentialsKey: 'my-s3-credentials',       // remote key holding AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY
    grafanaSecretStore: 'my-app-secret-store',   // ESO ClusterSecretStore (Grafana admin)
    grafanaCredentialsKey: 'my-grafana-admin',   // remote key holding admin-user / admin-password
  },
  // Override any default, e.g. storage: { prometheus: '30Gi' }
});

new MonitoringChart(app, 'monitoring', config);
app.synth();

mergeConfig requires namespace, clusterName, domains, s3, smtp, and integrations, and deep-merges everything else over DEFAULT_CONFIG. Attach your own dashboards (ConfigMaps labeled grafana_dashboard: "1") and PrometheusRules beside the chart; the library ships no application-specific content.

Documentation

The full documentation lives at https://bluedynamics.github.io/cdk8s-monitoring/**.

Prerequisites

The stack targets k3s or RKE2 clusters with ArgoCD and expects:

  • the k3s/RKE2 helm-controller (HelmChart resources of helm.cattle.io),
  • External Secrets Operator (S3 credentials, Grafana admin secret),
  • Crossplane with an S3 provider config (bucket provisioning),
  • the prometheus-operator CRDs, applied server-side,
  • a StorageClass named longhorn, or another class set in storage.className.

See Set up prerequisites for the details.

Development

This project is managed with projen. Do not edit generated files directly.

npx projen          # regenerate project files after editing .projenrc.ts
npx projen build    # compile + test + lint + package
npx projen test     # run tests

License

Apache-2.0

版本与发布记录

@bluedynamics/cdk8s-monitoring 共发布 32 个版本,首次发布于 2026/06/24;过去 12 个月发布了 32 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.13.0latest2026/11/053 天前
1.12.22026/11/053 天前
1.12.12026/11/035 天前
1.12.02026/11/017 天前
1.11.12026/11/017 天前
1.11.02026/11/017 天前

关于 @bluedynamics/cdk8s-monitoring 的常见问题

@bluedynamics/cdk8s-monitoring 是什么?

Generic cdk8s monitoring stack (Prometheus, Thanos, Loki, Grafana, Alloy) for Kubernetes

如何安装 @bluedynamics/cdk8s-monitoring?

在项目目录运行 npm install @bluedynamics/cdk8s-monitoring,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:cdk8s(^2.70.0)、constructs(^10.4.2)、cdk8s-plus-33(^2.4.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@bluedynamics/cdk8s-monitoring 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@bluedynamics/cdk8s-monitoring 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@bluedynamics/cdk8s-monitoring 可以商用吗?

@bluedynamics/cdk8s-monitoring 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@bluedynamics/cdk8s-monitoring 的下载量有多少?

根据 npm 官方下载统计,@bluedynamics/cdk8s-monitoring 在 2026/10/09 – 2026/11/07 这 30 天内被下载 3,061 次,日均约 102 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bluedynamics/cdk8s-monitoring 还在维护吗?

最新版本 1.13.0 发布于 2026/11/05(3 天前);至今共发布 32 个版本,其中过去 12 个月发布了 32 个;首次发布于 2026/06/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。