> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8a08bda2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Helm 部署选项

> 使用 Helm 部署 ClickStack 的高级配置选项

<Warning>
  **Helm 图表版本 2.x**

  本页介绍的是基于子图表 的 **v2.x** Helm 图表。如果你仍在使用 v1.x 内联模板图表，请参阅 [Helm 部署选项 (v1.x) ](/zh/clickstack/deployment/helm-deployment-options-v1)。如需迁移步骤，请参阅 [升级指南](/zh/clickstack/deployment/helm-upgrade)。
</Warning>

本指南介绍使用 Helm 部署 ClickStack 的高级部署选项。有关基本安装，请参阅 [Helm 部署主指南](/zh/clickstack/deployment/helm)。

<div id="overview">
  ## 概述
</div>

ClickStack 的 Helm 图表支持多种部署配置：

* **完整栈** (默认) — 包含所有组件，由 Operator 管理
* **外部 ClickHouse** — 使用现有的 ClickHouse 集群
* **外部 OTel collector** — 使用现有的 OTel 基础设施
* **最小化部署** — 仅包含 HyperDX，依赖外部服务

<div id="external-clickhouse">
  ## 外部 ClickHouse
</div>

如果你已有现成的 ClickHouse 集群 (包括 ClickHouse Cloud) ，可以禁用内置的 ClickHouse，并连接到外部实例。

<div id="external-clickhouse-inline">
  ### 选项 1：内联配置 (开发/测试)
</div>

这种方式适用于快速测试或非生产环境。通过 `hyperdx.config` 和 `hyperdx.secrets` 提供连接信息：

```yaml theme={null}
# values-external-clickhouse.yaml
clickhouse:
  enabled: false  # 禁用由 operator 管理的 ClickHouse

hyperdx:
  secrets:
    CLICKHOUSE_PASSWORD: "your-password"
    CLICKHOUSE_APP_PASSWORD: "your-password"

  defaultConnections: |
    [
      {
        "name": "External ClickHouse",
        "host": "http://your-clickhouse-server:8123",
        "port": 8123,
        "username": "your-username",
        "password": "your-password"
      }
    ]
```

使用以下配置安装：

```shell theme={null}
helm install my-clickstack clickstack/clickstack -f values-external-clickhouse.yaml
```

<div id="external-clickhouse-secret">
  ### 选项 2：外部 Secret (推荐用于生产环境)
</div>

对于希望将凭据与 Helm 配置分开管理的生产环境部署：

<div id="create-configuration">
  #### 创建配置文件
</div>

```bash theme={null}
# 创建 connections.json
cat <<EOF > connections.json
[
  {
    "name": "Production ClickHouse",
    "host": "https://your-production-clickhouse.com",
    "port": 8123,
    "username": "hyperdx_user",
    "password": "your-secure-password"
  }
]
EOF

# 创建 sources.json
cat <<EOF > sources.json
[
  {
    "from": {
      "databaseName": "default",
      "tableName": "otel_logs"
    },
    "kind": "log",
    "name": "Logs",
    "connection": "Production ClickHouse",
    "timestampValueExpression": "TimestampTime",
    "displayedTimestampValueExpression": "Timestamp",
    "implicitColumnExpression": "Body",
    "serviceNameExpression": "ServiceName",
    "bodyExpression": "Body",
    "eventAttributesExpression": "LogAttributes",
    "resourceAttributesExpression": "ResourceAttributes",
    "severityTextExpression": "SeverityText",
    "traceIdExpression": "TraceId",
    "spanIdExpression": "SpanId"
  },
  {
    "from": {
      "databaseName": "default",
      "tableName": "otel_traces"
    },
    "kind": "trace",
    "name": "Traces",
    "connection": "Production ClickHouse",
    "timestampValueExpression": "Timestamp",
    "displayedTimestampValueExpression": "Timestamp",
    "implicitColumnExpression": "SpanName",
    "serviceNameExpression": "ServiceName",
    "traceIdExpression": "TraceId",
    "spanIdExpression": "SpanId",
    "durationExpression": "Duration"
  }
]
EOF
```

<div id="create-kubernetes-secret">
  #### 创建 Kubernetes Secret
</div>

```bash theme={null}
kubectl create secret generic hyperdx-external-config \
  --from-file=connections.json=connections.json \
  --from-file=sources.json=sources.json

# 清理本地文件
rm connections.json sources.json
```

<div id="configure-helm-secret">
  #### 配置 Helm 使用该 Secret
</div>

```yaml theme={null}
# values-external-clickhouse-secret.yaml
clickhouse:
  enabled: false

hyperdx:
  useExistingConfigSecret: true
  existingConfigSecret: "hyperdx-external-config"
  existingConfigConnectionsKey: "connections.json"
  existingConfigSourcesKey: "sources.json"
```

```shell theme={null}
helm install my-clickstack clickstack/clickstack -f values-external-clickhouse-secret.yaml
```

<div id="using-clickhouse-cloud">
  ### 使用 ClickHouse Cloud
</div>

对于 ClickHouse Cloud：

```yaml theme={null}
# values-clickhouse-cloud.yaml
clickhouse:
  enabled: false

hyperdx:
  secrets:
    CLICKHOUSE_PASSWORD: "your-cloud-password"
    CLICKHOUSE_APP_PASSWORD: "your-cloud-password"

  useExistingConfigSecret: true
  existingConfigSecret: "clickhouse-cloud-config"
  existingConfigConnectionsKey: "connections.json"
  existingConfigSourcesKey: "sources.json"
```

<div id="external-otel-collector">
  ## 外部 OTel collector
</div>

如果您已有现成的 OTel collector 基础设施，请禁用该子图表：

```yaml theme={null}
# values-external-otel.yaml
otel-collector:
  enabled: false  # 禁用子图表 OTel collector

hyperdx:
  otelExporterEndpoint: "http://your-otel-collector:4318"
```

```shell theme={null}
helm install my-clickstack clickstack/clickstack -f values-external-otel.yaml
```

有关通过入口暴露 OTel collector 端点的说明，请参阅 [入口配置](/zh/clickstack/deployment/helm-configuration#otel-collector-ingress)。

<div id="minimal-deployment">
  ## 最小化部署
</div>

对于已有基础设施的组织，仅部署 HyperDX：

```yaml theme={null}
# values-minimal.yaml
clickhouse:
  enabled: false

otel-collector:
  enabled: false

hyperdx:
  otelExporterEndpoint: "http://your-otel-collector:4318"

  # Option 1: Inline (for testing)
  defaultConnections: |
    [
      {
        "name": "External ClickHouse",
        "host": "http://your-clickhouse-server:8123",
        "port": 8123,
        "username": "your-username",
        "password": "your-password"
      }
    ]

  # 选项 2：外部 Secret（生产环境）
  # useExistingConfigSecret: true
  # existingConfigSecret: "my-external-config"
  # existingConfigConnectionsKey: "connections.json"
  # existingConfigSourcesKey: "sources.json"
```

```shell theme={null}
helm install my-clickstack clickstack/clickstack -f values-minimal.yaml
```

<div id="next-steps">
  ## 后续步骤
</div>

* [配置指南](/zh/clickstack/deployment/helm-configuration) - API 密钥、Secret 和入口设置
* [Cloud 部署](/zh/clickstack/deployment/helm-cloud) - GKE、EKS 和 AKS 的特定配置
* [升级指南](/zh/clickstack/deployment/helm-upgrade) - 从 v1.x 迁移到 v2.x
* [附加清单](/zh/clickstack/deployment/helm-additional-manifests) - 自定义 Kubernetes 对象
* [Helm 主要指南](/zh/clickstack/deployment/helm) - 基本安装
* [部署选项 (v1.x) ](/zh/clickstack/deployment/helm-deployment-options-v1) - v1.x 部署选项
