reliability-metrics-ch-exporter

by Cast AI

Helm chartv0.3.19App v0.3.19Verified publisher

CAST AI Reliability Metrics infrastructure chart. Manages in-cluster ClickHouse (Altinity operator) or external ClickHouse, schema migrations, metrics exporter, and credentials for OTel collectors. Can be used standalone or as a subchart of castai-kvisor.

About this chart

CAST AI Reliability Metrics Helm Chart

This chart manages the complete reliability metrics infrastructure for CAST AI kvisor, consisting of three main components:

  • In-cluster ClickHouse - Database for metrics storage (via Altinity operator)
  • Schema Migration - Goose-based database migration system
  • Metrics Exporter - Exports aggregated metrics from ClickHouse to CAST AI

Components

1. In-cluster ClickHouse (in-cluster-clickhouse)

Production-grade ClickHouse deployment managed by the Altinity ClickHouse Operator.

Features:

  • Automatic pod management and recovery
  • Built-in monitoring and metrics
  • Schema versioning and upgrades
  • Persistent storage with configurable size
  • Resource limits and requests

Configuration:

operator:
  enabled: true  # Install Altinity operator

install:
  enabled: true  # Deploy ClickHouse via operator CRD
  resources:
    requests:
      cpu: 500m
      memory: 4Gi
    limits:
      memory: 8Gi
  persistence:
    size: 50Gi

2. Schema Migration (schema-migration)

Goose-based migration system that manages ClickHouse database schema.

Features:

  • Runs as a Kubernetes Job before ClickHouse Installation
  • Embeds SQL migrations in the binary
  • Idempotent - safe to re-run
  • Automatic rollback on failure

Migrations location: cmd/migrate/migrations/otel/

Configuration:

migrate:
  enabled: true  # Run migrations (default: true)
  image:
    repository: us-east4-docker.pkg.dev/castai-hub/kubecast/reliability-metrics-ch-exporter-migrate
    tag: ""  # defaults to Chart.AppVersion

3. Metrics Exporter (exporter)

Sidecar container in the ClickHouse pod that exports aggregated metrics to CAST AI.

Features:

  • Runs as sidecar in ClickHouse pod (zero network latency)
  • Exports silver tables (pre-aggregated metrics)
  • Automatic retry and backpressure handling
  • Prometheus metrics on :8080/metrics
  • Optional PodMonitor for Prometheus Operator integration

Configuration:

exporter:
  enabled: true
  image:
    repository: us-east4-docker.pkg.dev/castai-hub/kubecast/reliability-metrics-ch-exporter
    tag: ""  # defaults to Chart.AppVersion
  grpcAddr: "telemetry.cast.ai:443"
  resources:
    requests:
      memory: 64Mi
    limits:
      memory: 256Mi

Installation

As a subchart of castai-kvisor (recommended)

In kvisor/Chart.yaml:

dependencies:
  - name: reliability-metrics
    version: "0.2.0"
    repository: "https://charts.cast.ai"  # or OCI registry
    condition: reliabilityMetrics.enabled
    alias: reliabilityMetrics

In kvisor/values.yaml:

reliabilityMetrics:
  enabled: true
  # CAST AI credentials
  castai:
    apiKeySecretRef: "castai-kvisor"
    clusterID: "your-cluster-id"
    grpcAddr: "telemetry.cast.ai:443"
  # In-cluster ClickHouse
  operator:
    enabled: true
  install:
    enabled: true
    resources:
      requests:
        cpu: 500m
        memory: 4Gi
      limits:
        memory: 8Gi
    persistence:
      size: 50Gi
  # Authentication
  auth:
    database: "metrics"
    username: "kvisor"
    password: "kvisor"
  # Exporter
  exporter:
    enabled: true
    grpcAddr: "telemetry.cast.ai:443"

Then deploy:

helm dependency update ./charts/kvisor
helm upgrade castai-kvisor ./charts/kvisor -n castai-agent \
  -f charts/kvisor/obi-values.yaml \
  --set castai.apiKey=<key> \
  --set castai.clusterID=<id>

Standalone installation

helm install reliability-metrics ./chart -n reliability-metrics --create-namespace \
  --set enabled=true \
  --set operator.enabled=true \
  --set install.enabled=true \
  --set castai.apiKey=<key> \
  --set castai.clusterID=<id> \
  --set castai.grpcAddr=telemetry.cast.ai:443

Deployment Modes

Mode 1: In-cluster ClickHouse (Production)

Uses Altinity operator to manage ClickHouse in Kubernetes.

operator:
  enabled: true
install:
  enabled: true

Resources created:

  • ClickHouseOperator Deployment (manages ClickHouse lifecycle)
  • ClickHouseInstallation CR (defines ClickHouse cluster)
  • StatefulSet (managed by operator, contains ClickHouse + exporter)
  • Service (for ClickHouse access)
  • ConfigMaps (for ClickHouse configuration)

Mode 2: External ClickHouse

Point to an existing ClickHouse instance outside the cluster.

external:
  enabled: true
  address: "clickhouse.example.com:9000"
  username: "custom_user"  # optional override
  password: "custom_pass"  # optional override
  database: "custom_db"    # optional override

Note: Migration and operator are skipped in external mode. Only exporter runs.

Configuration

Authentication

auth:
  database: "metrics"  # ClickHouse database name
  username: "kvisor"   # ClickHouse username
  password: "kvisor"   # ClickHouse password

CAST AI Integration

castai:
  # Option 1: Direct API key
  apiKey: "your-api-key"

  # Option 2: Reference existing Secret
  apiKeySecretRef: "castai-kvisor"  # Secret containing 'API_KEY' key

  # Cluster ID
  clusterID: "your-cluster-id"

  # CAST AI gRPC endpoint
  grpcAddr: "telemetry.cast.ai:443"

Resources

install:
  resources:
    requests:
      cpu: 500m
      memory: 4Gi
    limits:
      memory: 8Gi
  persistence:
    size: 50Gi
    storageClass: ""  # use default storage class

exporter:
  resources:
    requests:
      memory: 64Mi
    limits:
      memory: 256Mi

Proxy Configuration (HTTPS_PROXY / HTTP_PROXY / NO_PROXY)

When the cluster routes outbound traffic through a corporate HTTP CONNECT proxy, set values under global.proxy. Each variable is independently optional — only the ones you set are emitted. Go's net/http honors these env vars automatically, including for the gRPC connection to the CAST AI mothership (HTTP CONNECT tunnel over HTTPS).

global:
  proxy:
    httpsProxy: "http://appproxy.corp.example:3128"
    httpProxy:  "http://appproxy.corp.example:3128"
    noProxy:    ".cluster.local,.svc,10.0.0.0/16,127.0.0.1,localhost"

When the chart is used as a subchart of castai-kvisor, set global.proxy once at the parent chart level — Helm's global mechanism propagates the values into this subchart automatically.

The exporter container's connection to ClickHouse uses native TCP (not HTTP) so it is unaffected by the proxy. Make sure noProxy includes any in-cluster service domains (e.g. .svc) you want to bypass.

Advanced Configuration

# ClickHouse server image
image:
  repository: clickhouse/clickhouse-server
  tag: "25.1.2.5-alpine"
  pullPolicy: IfNotPresent

# Node selection
nodeSelector: {}
tolerations: []
affinity: {}

# Operator configuration
operator:
  image:
    repository: altinity/clickhouse-operator
    tag: "0.26.0"
  metricsExporter:
    repository: altinity/metrics-exporter
    pullPolicy: IfNotPresent

Monitoring

PodMonitor (Prometheus Operator)

The exporter exposes Prometheus metrics on :8080/metrics. To scrape them via Prometheus Operator, enable the PodMonitor:

exporter:
  podMonitor:
    enabled: true
    # Extra labels for Prometheus Operator selector filtering
    labels:
      release: prometheus
    interval: 30s
    scrapeTimeout: 10s

The PodMonitor selector is auto-detected based on deployment mode:

ModeSelector
install.enabled=true (sidecar)clickhouse.altinity.com/chi: <fullname>
install.enabled=false (standalone)app.kubernetes.io/name: <fullname>-exporter

To override the auto-detected selector (e.g. custom label schemes):

exporter:
  podMonitor:
    enabled: true
    selectorLabels:
      my-custom-label: my-value

Annotation-based scraping

If you don't use Prometheus Operator, the standalone Deployment already includes annotations for annotation-based discovery:

prometheus.io/scrape: "true"
prometheus.io/port: "8080"

Troubleshooting

Check ClickHouse pod status

kubectl get pods -n castai-agent | grep clickhouse

Expected output:

castai-kvisor-clickhouse-operator-xxx   2/2   Running
chi-castai-kvisor-clickhouse-otel-0-0-0  2/2   Running

Check exporter logs

kubectl logs -n castai-agent chi-castai-kvisor-clickhouse-otel-0-0-0 -c ch-exporter

Healthy output:

level=info msg="rows exported to CastAI" rows=100 table=reliability_metrics_gauge
level=info msg="data is synced to CastAI" table=reliability_metrics_gauge

Check ClickHouse connectivity

kubectl exec -n castai-agent chi-castai-kvisor-clickhouse-otel-0-0-0 -c clickhouse -- \
  clickhouse-client --query "SELECT version()"

Common Issues

1. Exporter authentication errors

error="rpc error: code = Unauthenticated desc = authentication token not found"

Solution: Ensure CAST AI credentials are set:

castai:
  apiKeySecretRef: "castai-kvisor"  # or apiKey: "..."
  clusterID: "your-cluster-id"

2. Migration job fails

Check migration logs:

kubectl logs -n castai-agent castai-kvisor-clickhouse-migrate-xxx

Solution: Ensure ClickHouse is ready and credentials are correct.

3. ClickHouse pod ImagePullBackOff

Check image repository and credentials:

image:
  repository: clickhouse/clickhouse-server
  tag: "25.1.2.5-alpine"

Credentials Secret

The chart automatically creates a credentials Secret used by OTel collectors:

apiVersion: v1
kind: Secret
metadata:
  name: castai-kvisor-clickhouse-credentials
data:
  address: <base64>    # ClickHouse address
  database: <base64>   # Database name
  username: <base64>   # Username
  password: <base64>   # Password

This Secret is referenced by kvisor agent and controller OTel collector containers.

Values Reference

ParameterDescriptionDefault
enabledMaster switch for the chartfalse
operator.enabledInstall Altinity operatorfalse
install.enabledDeploy ClickHouse via operatorfalse
external.enabledUse external ClickHousefalse
auth.databaseClickHouse database name"kvisor"
auth.usernameClickHouse username"kvisor"
auth.passwordClickHouse password"kvisor"
exporter.enabledEnable metrics exporterfalse
exporter.grpcAddrCAST AI gRPC endpoint""
exporter.podMonitor.enabledCreate PodMonitor for Prometheus Operatorfalse
exporter.podMonitor.labelsExtra labels on PodMonitor metadata{}
exporter.podMonitor.selectorLabelsOverride auto-detected pod selector{}
exporter.podMonitor.intervalScrape interval"30s"
exporter.podMonitor.scrapeTimeoutScrape timeout"10s"
migrate.enabledRun schema migrationstrue
castai.apiKeyCAST AI API key (direct)""
castai.apiKeySecretRefCAST AI API key (from Secret)""
castai.clusterIDCAST AI cluster ID""
castai.grpcAddrCAST AI gRPC endpoint""

Deploy reliability-metrics-ch-exporter with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has reliability-metrics-ch-exporter on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartreliability-metrics-ch-exporter is pinned at v0.3.19 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply