跳转到内容

自定义 Value 配置说明

本文档说明 values.yaml 中各字段的含义与配置方式。

全局配置(global

字段类型默认值说明
global.imagePullSecretslist[]镜像拉取凭证(私有仓库认证)
global.clusterDomainstringcluster.localKubernetes 集群域名
global.podAntiAffinityPresetstringsoftPod 反亲和策略:soft(尽量分散)/ hard(强制分散)/ none(不设置)
global.settings.loginHoststring""登录主机地址,修改后前端应用中显示的 API Key 登录地址会随之变化(不影响实际后端服务地址)

Pod 反亲和性

您可以通过设置 global.podAntiAffinityPreset 来控制 Pod 的分布策略,以提升容灾能力:

Pod 反亲和性配置示例
yaml
global:
  podAntiAffinityPreset: "soft" # soft, hard, or none
  • soft(默认):所有 Pod 将尽量均匀分布在各个 Node 上
  • hard:确保同一服务的 Pod 不会分布在同一 Node 上
  • none:禁用 Pod 反亲和性

登录域名(loginHost)

默认情况下,<Your Host>/space/~/quick-start 页面中显示的 login host 会自动使用您当前访问前端的域名 <Your Host>。如果您需要修改此值,可以通过配置 global.settings.loginHost 指定为您期望的域名。

注意:此设置不会影响实际的后端服务地址,您需要自己配置对应的转发规则。

网关(gateway

字段类型默认值说明
gateway.replicasint2网关副本数
gateway.image.repositorystringrepo.swanlab.cn/public/traefikTraefik 网关镜像地址
gateway.image.tagstring3.6Traefik 镜像标签
gateway.identifyImage.repositorystringrepo.swanlab.cn/public/swanlab-helper/identify网关鉴权辅助镜像地址
gateway.identifyImage.tagstringv1.2鉴权辅助镜像标签
gateway.service.typestringClusterIPService 类型
gateway.service.ports.webint80非安全入口端口(可从集群外部访问)
gateway.service.ports.internalint8080内部入口端口(仅集群内部访问)
gateway.service.ports.traefikint8081Traefik 仪表盘端口
gateway.service.ports.metricsint9100Prometheus 指标采集端口
gateway.customNodeSelectorobject{}节点选择器,例如 { swanlab: "true" }

配置应用访问入口

应用服务在集群中的域名为您部署的 release 名称。例如,假设您的 cluster domaincluster.local,假设您的部署命令为:

bash
# 假设默认 release_name 为 swanlab-self-hosted
helm install swanlab-self-hosted swanlab/self-hosted -n <your_namespace>
  • 应用在 <your_namespace> 命名空间下的域名为 swanlab-self-hosted 即 (<release_name>)
  • 应用在 kubernetes 集群下的域名为:swanlab-self-hosted.<your_namespace>.svc.cluster.local

您可以基于如上信息编写负载均衡策略。通常建议您优先使用 独立域名(Host-based) 来配置访问策略,以规避因路径规则复杂或变更导致的路由冲突。

基于架构解耦原则swanlab-self-hosted 不内置 Ingress 控制器。您需要在集群的负载均衡器(或 Ingress)上配置外部访问入口,并由其负责 TLS 终止(HTTPS 卸载)

在安全策略方面,应用默认信任所有的 X-Forwarded-* 请求头。如果您需要更严格的头部校验或转发控制,请务必在负载均衡层统一实施——这有可能影响到内部 S3 的签名效果,如果您使用外部对象存储服务,则不需要有这方面担忧。

指标缓冲队列(vector

字段类型默认值说明
vector.replicasint2Vector 副本数
vector.image.repositorystringrepo.swanlab.cn/public/vectorVector 镜像地址
vector.image.tagstring0.51.1-debianVector 镜像标签
vector.sinks.bufferMaxSizeint10737418240缓冲区最大大小(字节),不得超过 persistence.storageSize 的 1/3
vector.persistence.storageClassstring""StorageClass(留空使用集群默认)
vector.persistence.storageSizestring60Gi存储卷大小,建议至少 60Gi,确保 ≥ bufferMaxSize 的 3 倍

⚠️ Vector 的 PVC 名称默认不可修改(data-swanlab-self-hosted-vector-0 / data-swanlab-self-hosted-vector-1)。

辅助容器(helper

字段类型默认值说明
helper.image.repositorystringrepo.swanlab.cn/public/busyboxBusybox 镜像地址(用于各组件健康检查等)
helper.image.tagstring1.37.0Busybox 镜像标签

应用服务(service

SwanLab-Server(后端服务)

字段类型默认值说明
service.server.replicasint2副本数
service.server.image.repositorystringrepo.swanlab.cn/self-hosted/swanlab-server镜像地址
service.server.image.tagstring""镜像标签,置为空字符串以自动同步 Chart 指定的版本号

SwanLab-House(后端实验 OLAP 服务)

字段类型默认值说明
service.house.replicasint2副本数
service.house.image.repositorystringrepo.swanlab.cn/self-hosted/swanlab-house镜像地址
service.house.image.tagstring""镜像标签,置为空字符串以自动同步 Chart 指定的版本号
service.house.persistence.storageClassstring""StorageClass
service.house.persistence.storageSizestring10Gi存储卷大小

存储说明swanlab-houseStatefulSet 部署,需要挂载存储卷。与基础服务不同,此处不支持配置 existingClaimswanlab-house 会在存储卷下存储一些指标中间产物,一般情况下您不需要关心此存储卷中的数据。

SwanLab-Cloud(前端图表)

字段类型默认值说明
service.cloud.replicasint1副本数
service.cloud.image.repositorystringrepo.swanlab.cn/self-hosted/swanlab-cloud镜像地址
service.cloud.image.tagstring""镜像标签,置为空字符串以自动同步 Chart 指定的版本号

SwanLab-Next(前端UI)

字段类型默认值说明
service.next.replicasint2副本数
service.next.image.repositorystringrepo.swanlab.cn/self-hosted/swanlab-next镜像地址
service.next.image.tagstring""镜像标签,置为空字符串以自动同步 Chart 指定的版本号

应用镜像标签说明service 下的四个应用镜像(server / house / cloud / next)的 tag 均应设置为空字符串而非 latest,Chart 会在渲染时自动注入正确的版本号。

通用字段(所有 service 均支持)

字段类型默认值说明
*.customLabelsobject{}自定义 Service 标签
*.customAnnotationsobject{}自定义 Service 注解
*.customPodLabelsobject{}自定义 Pod 标签
*.customPodAnnotationsobject{}自定义 Pod 注解
*.customTolerationslist[]自定义容忍度(Toleration)
*.customNodeSelectorobject{}节点选择器,JSON 格式,例如 { swanlab: "true" }
*.resourcesobject{}资源限制(requests/limits),例如 { requests: { cpu: "500m", memory: "512Mi" } }

应用性能是一个复杂的计算指标,通常还取决于资源限制。建议同时通过 resources 字段合理配置 CPU 和内存用量。

内置基础服务(dependencies

integrations.<service>.enabledfalse 时,Chart 会在集群内自动部署以下组件。

存储资源配置建议

如果您使用内置的单实例基础服务,建议您自行声明 storage-class 以支持数据持久化。

在进行自定义存储类配置之前,请确保:

  1. 对应的基础服务资源没有开启 integrations
  2. 您的 storage-classclaim 已存在于集群中

配置方式(以 PostgreSQL 为例):

  1. 自动创建存储卷:配置 dependencies.postgres.persistence 下的 storageClassstorageSize
  2. 使用已有存储卷:通过 dependencies.postgres.persistence.existingClaim 指定已存在的 PVC(推荐做法,确保存储资源由您自己管理)

其他基础服务(Redis、ClickHouse、MinIO)的存储配置方式相同。

PostgreSQL

字段类型默认值说明
dependencies.postgres.image.repositorystringrepo.swanlab.cn/self-hosted/postgres镜像地址
dependencies.postgres.image.tagstring16.1镜像标签,建议 16.x 及以上
dependencies.postgres.usernamestring""数据库用户名
dependencies.postgres.passwordstring""数据库密码
dependencies.postgres.persistence.existingClaimstring""使用已有的 PVC 名称(留空则自动创建)
dependencies.postgres.persistence.storageClassstring""StorageClass
dependencies.postgres.persistence.storageSizestring10Gi存储卷大小

Redis

字段类型默认值说明
dependencies.redis.image.repositorystringrepo.swanlab.cn/self-hosted/redis-stack镜像地址
dependencies.redis.image.tagstring7.4.0-v8镜像标签
dependencies.redis.persistence.existingClaimstring""使用已有的 PVC 名称(留空则自动创建)
dependencies.redis.persistence.storageClassstring""StorageClass
dependencies.redis.persistence.storageSizestring10Gi存储卷大小

ClickHouse

字段类型默认值说明
dependencies.clickhouse.image.repositorystringrepo.swanlab.cn/self-hosted/clickhouse-server镜像地址
dependencies.clickhouse.image.tagstring24.3镜像标签
dependencies.clickhouse.usernamestring""数据库用户名(如使用 existingSecret 则留空)
dependencies.clickhouse.passwordstring""数据库密码(如使用 existingSecret 则留空)
dependencies.clickhouse.persistence.existingClaimstring""使用已有的 PVC 名称(留空则自动创建)
dependencies.clickhouse.persistence.storageClassstring""StorageClass
dependencies.clickhouse.persistence.storageSizestring20Gi存储卷大小

MinIO(内置 S3 对象存储)

如已集成外部 S3,可忽略此项。

字段类型默认值说明
dependencies.s3.image.repositorystringrepo.swanlab.cn/self-hosted/minio/minioMinIO 镜像地址
dependencies.s3.image.tagstringRELEASE.2025-09-07T16-13-09ZMinIO 镜像标签
dependencies.s3.mcImage.repositorystringrepo.swanlab.cn/self-hosted/minio/mcMinIO 客户端镜像地址
dependencies.s3.mcImage.tagstringRELEASE.2025-08-13T08-35-41ZMinIO 客户端镜像标签
dependencies.s3.accessKeystring""Access Key
dependencies.s3.secretKeystring""Secret Key(留空将自动生成)
dependencies.s3.persistence.existingClaimstring""使用已有的 PVC(留空则自动创建)
dependencies.s3.persistence.storageClassstring""StorageClass
dependencies.s3.persistence.storageSizestring20Gi存储卷大小

外部基础服务集成(integrations

integrations 部分用于接入外部已有的基础服务(数据库、缓存、对象存储等),替代 Chart 内置的单实例部署。

WARNING

如果您将任一集成基础服务资源开启(例如设置 integrations.postgres.enabledtrue),swanlab-self-hosteddenpendencies 中部署的对应单实例服务将被销毁。

【建议】外部对象存储 S3(integrations.s3

用于接入外部 S3 兼容对象存储(如阿里云 OSS、腾讯云 COS、AWS S3 等),要求 必须兼容 AWS S3 协议

WARNING

如果您所在的云对象存储对 S3 协议的 endpoint 访问做了区分,需要请特别注意应该填写 S3 endpoint

s3-Config

字段类型默认值说明
integrations.s3.enabledbooltrue启用后支持集成外部 S3(启用后 dependencies.s3 不会部署)
integrations.s3.existingSecretstringswanlab-secret-s3存储 AK/SK 的 K8s Secret 名称

Secret 数据结构(integrations.s3.existingSecret):

.data.<keys>说明
accessKey对象存储访问密钥
secretKey对象存储密钥

Public 桶配置(integrations.s3.public

字段类型默认值说明
public.sslbooltrue是否启用 SSL
public.endpointstring""S3 接入点,不带 bucket 前缀,例如 oss-cn-beijing.aliyuncs.com
public.regionstring""S3 地域,例如 cn-beijing
public.portint443端口号
public.domainstring""Public 桶 URL,需携带 https:// 前缀,例如 https://<bucket_name>.oss-cn-beijing.aliyuncs.com
public.pathStyleboolfalse路径访问方式,公有云对象存储通常设为 false
public.bucketstring""桶名称

📎 特别说明:主流云厂商基本不再推荐使用 pathStyle=True 的路径命名方式,默认均为 False,区别可参考阅读: Virtual hosting of general purpose buckets-AWS

Private 桶配置(integrations.s3.private

字段类型默认值说明
private.sslbooltrue是否启用 SSL
private.endpointstring""S3 接入点,不带 bucket 前缀,例如 oss-cn-beijing.aliyuncs.com
private.regionstring""S3 地域,例如 cn-beijing
private.portint443端口号
private.pathStyleboolfalse路径访问方式,公有云对象存储通常设为 false
private.bucketstring""桶名称
外部集成 S3 对象存储配置示例
yaml
integrations:
  s3:
    enabled: true
    public:
      ssl: true
      endpoint: "xxx.s3.com"
      region: "cn-beijing"
      pathStyle: false
      port: 443
      domain: "https://xxx.xxxx.s3.com"
      bucket: "swanlab-public"
    private:
      ssl: true
      endpoint: "xxx.s3.com"
      region: "cn-beijing"
      pathStyle: false
      port: 443
      bucket: "swanlab-private"
    existingSecret: integration-s3

WARNING

  • publicBucket 的权限为公有读私有写,privateBucket 的权限为私有读写
  • 当您选择自定义对象存储服务时,请保证您的对象存储服务可以直接通过外部访问(通过 IP 或域名)
  • 您的对象存储密钥必须对 publicBucketprivateBucket 同时有写权限和 S3 签名权限

【不推荐】外部 PostgreSQL(integrations.postgres

接入外部 PostgreSQL(自建 cnpg 集群或云厂商 RDS)。

字段类型默认值说明
integrations.postgres.enabledboolfalse启用后使用外部 PostgreSQL,内置单实例将被移除
integrations.postgres.hoststring""数据库主机地址
integrations.postgres.portint5432数据库端口
integrations.postgres.databasestring""数据库名称
integrations.postgres.existingSecretstring""存储凭据的 K8s Secret 名称

Secret 数据结构(integrations.postgres.existingSecret):

.data.<keys>说明
username可读可写用户名称
password可读可写用户密码
primaryUrl可读可写数据库连接串,格式:postgresql://{username}:${password}@postgres:5432/app?schema=public
replicaUrl只读数据库连接串,一般用于负载均衡。如果未配置只读用户/集群,可使用可读可写连接串代替
外部集成 PostgreSQL 配置示例
yaml
integrations:
  postgres:
    enabled: true
    host: "example.postgres"
    port: 5432
    database: "app"
    existingSecret: integration-postgres

请保证上述配置与 Secret 中能对应上。详细密钥数据结构说明请参阅 values.yaml

【不推荐】外部 Redis(integrations.redis

接入外部 Redis(自建集群或云厂商 Redis 服务)。

字段类型默认值说明
integrations.redis.enabledboolfalse启用后使用外部 Redis,内置单实例将被移除
integrations.redis.hoststring""Redis 主机地址
integrations.redis.portint6379Redis 端口
integrations.redis.databasestring"0"数据库编号
integrations.redis.existingSecretstring""存储凭据的 K8s Secret 名称

Secret 数据结构(integrations.redis.existingSecret):

.data.<keys>说明
url数据库连接串,格式:redis://{username}:${password}@redis:6379
外部集成 Redis 配置示例
yaml
integrations:
  redis:
    enabled: true
    host: "example.redis"
    port: 6379
    database: "0"
    existingSecret: integration-redis

请保证上述配置与 Secret 中能对应上。

【不推荐】外部 ClickHouse(integrations.clickhouse

接入外部 ClickHouse(自建集群或云厂商服务)。

字段类型默认值说明
integrations.clickhouse.enabledboolfalse启用后使用外部 ClickHouse,内置单实例将被移除
integrations.clickhouse.hoststring""ClickHouse 主机地址
integrations.clickhouse.httpPortint8123HTTP 协议端口
integrations.clickhouse.tcpPortint9000TCP 协议端口
integrations.clickhouse.databasestring""数据库名称
integrations.clickhouse.existingSecretstring""存储凭据的 K8s Secret 名称

Secret 数据结构(integrations.clickhouse.existingSecret):

.data.<keys>说明
username可读可写用户名称
password可读可写用户密码
外部集成 ClickHouse 配置示例
yaml
integrations:
  clickhouse:
    enabled: true
    host: "example.clickhouse"
    httpPort: 8123
    tcpPort: 9000
    database: "app"
    existingSecret: integration-clickhouse

请保证上述配置与 Secret 中能对应上。