KubeSphere Helm Chart 参数

全局配置

参数 描述 默认值

global.imageRegistry

全局 Docker 镜像仓库地址

registry.cn-beijing.aliyuncs.com

global.tag

全局 Docker 镜像标签

v4.1.3

global.imagePullSecrets

全局 Docker 仓库密钥名称数组

[]

通用参数

参数 描述 默认值

nameOverride

部分覆盖 common.names.fullname 的字符串

""

fullnameOverride

完全覆盖 common.names.fullname 的字符串

""

commonLabels

添加到所有部署对象的标签

{}

commonAnnotations

添加到所有部署对象的注解

{}

多集群配置

参数 描述 默认值

multicluster.role

多集群角色 (host/member)

""

multicluster.hostClusterName

主集群名称

""

Portal 配置

参数 描述 默认值

portal.hostname

ks-console 服务的公开入口域名或 IP 地址

ks-console.kubesphere-system.svc

portal.http.port

ks-console 服务通过公开入口暴露的 HTTP 端口号

30880

S3 存储配置

参数 描述 默认值

s3.endpoint

S3 端点 URL

""

s3.region

S3 区域

us-east-1

s3.disableSSL

禁用 S3 SSL

true

s3.forcePathStyle

强制 S3 路径样式

true

s3.accessKeyID

S3 访问密钥 ID

admin

s3.secretAccessKey

S3 访问密钥

admin

s3.bucket

S3 存储桶名称

uploads

认证配置

参数 描述 默认值

authentication.authenticateRateLimiterMaxTries

认证最大尝试次数

10

authentication.authenticationRateLimiterDuration

限流器持续时间

10m0s

authentication.loginHistoryRetentionPeriod

登录历史保留期限

168h

authentication.enableMultiLogin

启用多点登录

true

authentication.maxInactivityDuration

最大不活动持续时间

0s

authentication.adminPassword

管理员密码

""

authentication.issuer.maximumClockSkew

JWT 令牌验证时允许的最大时钟偏差

10s

authentication.issuer.jwtSecret

用于签发 JWT 的密钥

""

authentication.issuer.accessTokenMaxAge

访问令牌最大有效期

2h

authentication.issuer.accessTokenInactivityTimeout

JWT 访问令牌的不活跃超时时间

30m

实验性功能

参数 描述 默认值

experimental.validationDirective

资源验证模式(严格/忽略/警告)

""

experimental.maintenance

是否启用维护模式

false

审计配置

参数 描述 默认值

auditing.enable

启用审计

false

auditing.auditLevel

审计级别(元数据/请求/请求响应)

Metadata

auditing.logOptions.path

审计日志路径

/etc/audit/audit.log

auditing.logOptions.maxAge

审计日志的最大保留天数

7

auditing.logOptions.maxBackups

审计日志的最大备份数

10

auditing.logOptions.maxSize

审计日志文件的最大大小(MB)

100

服务账户配置

参数 描述 默认值

serviceAccount.create

创建服务账户

true

serviceAccount.annotations

服务账户注解

{}

serviceAccount.name

服务账户名称

kubesphere

Pod 配置

参数 描述 默认值

tolerations

Pod 容忍配置

[]

affinity

Pod 亲和性配置

{}

nodeSelector

Pod 节点选择器

{}

internalTLS

启用组件间 TLS 通信

false

API 服务器配置

参数 描述 默认值

apiserver.image.registry

ks-apiserver 的镜像注册中心地址

""

apiserver.image.repository

ks-apiserver 的镜像仓库路径

kse/ks-apiserver

apiserver.image.tag

ks-apiserver 的镜像标签

""

apiserver.image.digest

ks-apiserver 的镜像摘要

""

apiserver.image.pullPolicy

ks-apiserver 的镜像拉取策略

IfNotPresent

apiserver.containerPorts

ks-apiserver 容器启用的端口列表

[]

apiserver.resources.limits

ks-apiserver 容器的资源限制

{}

apiserver.resources.requests

ks-apiserver 容器的资源请求

{}

apiserver.command

覆盖默认容器命令

[]

apiserver.extraEnvVars

额外环境变量列表

[]

apiserver.extraVolumeMounts

额外 volumeMounts 列表

[]

apiserver.extraVolumes

额外 volumes 列表

[]

apiserver.hardAntiAffinity

是否启用强反亲和性调度

false

控制台配置

参数 描述 默认值

console.image.registry

console 镜像仓库地址

""

console.image.repository

console 的镜像命名空间

kse/ks-console

console.image.tag

console 镜像标签

""

console.image.digest

console 镜像摘要

""

console.image.pullPolicy

console 镜像拉取策略

IfNotPresent

console.config.enenableNodeListTerminal

在控制台中启用节点列表终端

true

console.containerPorts

ks-console 容器启用的端口列表

[]

console.nodePort

console 服务的节点端口

30880

console.resources.limits

ks-console 容器的资源限制

{}

console.resources.requests

ks-console 容器的资源请求

{}

console.command

覆盖默认容器命令

[]

console.extraEnvVars

添加到 ks-console 的额外环境变量数组

[]

console.extraVolumeMounts

ks-console 容器的额外 volumeMounts 列表

[]

console.extraVolumes

ks-console Pod 的额外 volumes 列表

[]

console.hardAntiAffinity

是否强制 ks-console Pod 运行在不同节点上

false

控制器配置

参数 描述 默认值

controller.image.registry

控制器镜像仓库地址

""

controller.image.repository

控制器的镜像命名空间

kse/ks-controller-manager

controller.image.tag

控制器镜像标签

""

controller.image.digest

控制器镜像摘要

""

controller.image.pullPolicy

控制器镜像拉取策略

IfNotPresent

controller.containerPorts

ks-controller-manager 容器启用的端口列表

[]

controller.resources.limits

ks-controller-manager 容器的资源限制

{}

controller.resources.requests

ks-controller-manager 容器的资源请求

{}

controller.command

覆盖默认容器命令

[]

controller.extraEnvVars

添加到 ks-controller-manager 的额外环境变量数组

[]

controller.extraVolumeMounts

ks-controller-manager 容器的额外 volumeMounts 列表

[]

controller.extraVolumes

ks-controller-manager Pod 的额外 volumes 列表

[]

controller.hardAntiAffinity

是否强制 ks-controller-manager Pod 运行在不同节点上

false

代理配置

参数 描述 默认值

agent.replicaCount

代理副本数量

1

Helm 执行器配置

参数 描述 默认值

helmExecutor.timeout

Helm 执行器超时时间

10m

helmExecutor.historyMax

Helm 历史记录最大数量

2

helmExecutor.jobTTLAfterFinished

任务完成后的存活时间

0s

helmExecutor.image.registry

Helm 执行器的镜像仓库地址

""

helmExecutor.image.repository

Helm 执行器的镜像命名空间

kubesphereio/kubectl

helmExecutor.image.tag

Helm 执行器镜像标签

v1.27.12

helmExecutor.image.pullPolicy

Helm 执行器镜像拉取策略

IfNotPresent

helmExecutor.resources.limits

Helm 执行器的资源限制

{}

helmExecutor.resources.requests

Helm 执行器的资源请求

{}

helmExecutor.affinity

Helm 执行器的亲和性配置

{}

自制应用配置

参数 描述 默认值

composedApp.appSelector

用于筛选需要协调的 K8s 应用的选择器

""

Kubectl 配置

参数 描述 默认值

kubectl.image.registry

Kubectl 镜像仓库地址

""

kubectl.image.repository

Kubectl 的镜像命名空间

kubesphereio/kubectl

kubectl.image.tag

Kubectl 镜像标签

v1.33.1

kubectl.image.pullPolicy

Kubectl 镜像拉取策略

IfNotPresent

Ingress 配置

参数 描述 默认值

ingress.enabled

启用 Ingress

false

ingress.ingressClassName

Ingress 类名称

""

ingress.tls.enabled

启用 TLS

true

ingress.tls.source

TLS 来源 (生成/导入/Let’s Encrypt)

generation

ingress.tls.secretName

TLS 证书 Secret 名称

kubesphere-tls-certs

Let’s Encrypt 配置

参数 描述 默认值

letsEncrypt.environment

Let’s Encrypt 环境 (生产/测试)

production

证书管理器配置

参数 描述 默认值

certmanager.duration

证书有效期

2160h

certmanager.renewBefore

证书到期前续订时间

360h

Node Shell 配置

参数 描述 默认值

nodeShell.image.registry

Node Shell 镜像仓库地址

""

nodeShell.image.repository

Node Shell 镜像命名空间

kubesphereio/kubectl

nodeShell.image.tag

Node Shell 镜像标签

v1.27.12

nodeShell.image.pullPolicy

Node Shell 镜像拉取策略

IfNotPresent

云配置

参数 描述 默认值

cloud.enabled

启用云功能

false

cloud.env

云环境

kubesphere.cloud

cloud.customEnv

自定义云环境配置

{}

扩展配置

参数 描述 默认值

extension.imageRegistry

扩展组件的镜像注册中心地址

""

extension.nodeSelector

扩展组件的节点选择器

{}

extension.ingress.ingressClassName

扩展组件的 Ingress Class 名称

""

extension.ingress.domainSuffix

为扩展组件自动分配的域名后缀

""

extension.ingress.httpPort

为扩展组件自动分配的 HTTP 端口

80

extension.ingress.httpsPort

为扩展组件自动分配的 HTTPS 端口

443

高可用配置

参数 描述 默认值

ha.enabled

启用高可用模式

false

Redis 配置

参数 描述 默认值

redis.port

Redis 服务端口

6379

redis.replicaCount

Redis 副本数量

1

redis.image.registry

Redis 镜像仓库地址

""

redis.image.repository

Redis 的镜像命名空间

kubesphereio/redis

redis.image.digest

Redis 镜像摘要

""

redis.image.tag

Redis 镜像标签

7.2.4-alpine

redis.image.pullPolicy

Redis 镜像拉取策略

IfNotPresent

redis.persistentVolume.enabled

启用 Redis 持久卷

true

redis.persistentVolume.size

Redis 持久卷大小

2Gi

Redis 高可用配置

参数 描述 默认值

redisHA.enabled

启用 Redis 高可用

false

redisHA.redis.port

Redis 高可用端口

6379

redisHA.image.registry

Redis 高可用的镜像仓库地址

""

redisHA.image.repository

Redis 高可用的镜像命名空间

kubesphereio/redis

redisHA.image.tag

Redis 高可用的镜像标签

7.2.4-alpine

redisHA.image.digest

Redis 高可用的镜像摘要

""

redisHA.image.pullPolicy

Redis 高可用的镜像拉取策略

IfNotPresent

redisHA.persistentVolume.enabled

启用 Redis 高可用持久卷

true

redisHA.persistentVolume.size

Redis 高可用持久卷大小

2Gi

redisHA.tolerations

Redis 高可用容忍设置

[]

redisHA.hardAntiAffinity

Redis 高可用硬反亲和性

false

redisHA.additionalAffinities

Redis 高可用额外亲和性设置

{}

redisHA.haproxy.servicePort

HAProxy 服务端口

6379

redisHA.haproxy.containerPort

HAProxy 容器端口

6379

redisHA.haproxy.image.registry

HAProxy 镜像仓库地址

""

redisHA.haproxy.image.repository

HAProxy 镜像命名空间

kubesphereio/haproxy

redisHA.haproxy.image.tag

HAProxy 镜像标签

2.9.6-alpine

redisHA.haproxy.image.digest

HAProxy 镜像摘要

""

redisHA.haproxy.image.pullPolicy

HAProxy 镜像拉取策略

IfNotPresent

redisHA.haproxy.hardAntiAffinity

HAProxy 硬反亲和性设置

false

redisHA.haproxy.additionalAffinities

HAProxy 额外亲和性配置

{}

KubeSphere CRDs 配置

参数 描述 默认值

ksCRDs.kubectl.image.registry

CRDs 使用的 kubectl 镜像仓库地址

""

ksCRDs.kubectl.image.repository

CRDs 使用的 kubectl 镜像命名空间

kubesphereio/kubectl

ksCRDs.kubectl.image.tag

CRDs 使用的 kubectl 镜像标签

v1.27.12

ksCRDs.kubectl.image.pullPolicy

CRDs 使用的 kubectl 镜像拉取策略

IfNotPresent

KSE 扩展仓库配置

参数 描述 默认值

kseExtensionRepository.enabled

启用 KSE 扩展组件仓库

true

kseExtensionRepository.image.registry

扩展仓库的镜像仓库地址

""

kseExtensionRepository.image.repository

扩展仓库的镜像命名空间

kse/extensions-museum

kseExtensionRepository.image.tag

扩展仓库镜像标签

v10.2.3

kseExtensionRepository.image.pullPolicy

扩展仓库镜像拉取策略

IfNotPresent

TLS 配置

  1. 选择 SSL 配置

    KubeSphere 安全配置分为网关 SSL 配置以及内部服务 SSL 配置两个部分。其中网关 SSL 配置默认支持以下三种模式来启用 SSL/TLS,以保证访问的安全性。

    1. 网关 SSL 配置

      配置 Helm Chart 选项 是否需要 cert-manager

      KubeSphere 生成的 TLS 证书

      ingress.tls.source=generation

      Let’s Encrypt

      ingress.tls.source=letsEncrypt

      导入已有的证书

      ingress.tls.source=importation

      • KubeSphere 生成的 TLS 证书:支持 cert-manager 和 helm 两种方式。

        • 如果 Kubernetes 集群中已安装 cert-manager,则首选使用 cert-manager 生成证书。KubeSphere 使用 cert-manager 签发并维护证书。KubeSphere 会生成自己的 CA 证书,并用该 CA 签署证书,然后由 cert-manager 管理该证书。

        • 如果未安装 cert-manager,则使用 helm 生成证书。在使用 helm 安装的过程中,KubeSphere 会根据设置的 hostname 生成 CA 和 TLS 证书。在此选项下,证书不支持自动过期轮转。

      • Let’s Encrypt

        使用 Let’s Encrypt 选项必须使用 cert-manager。但是,在这种情况下,cert-manager 与 Let’s Encrypt 的特殊颁发者相结合,该颁发者执行获取 Let’s Encrypt 颁发证书所需的所有操作,包括请求和验证。此配置使用 HTTP 验证(HTTP-01),因此负载均衡器必须具有可以从互联网访问的公共 DNS 记录。

      • 导入已有的证书

        使用已有的 CA 颁发的公有或私有证书。KubeSphere 将使用该证书来保护 WebSocket 和 HTTPS 流量。在这种情况下,您必须上传名称分别为 tls.crt 和 tls.key 的 PEM 格式的证书以及相关的密钥。如果您使用私有 CA,则还必须上传该 CA 证书。这是由于您的节点可能不信任此私有 CA。

    2. 内部服务 SSL 配置

      启用内部 SSL 配置之后,KubeSphere 中 Console UI 和 Apiserver 均会启用 HTTPS,内置支持 cert-manager 和 helm 生成证书。在 Kubernetes 集群已安装 cert-manager 的情况下优先使用 cert-manager 生成/管理证书,证书的 DNS 默认使用 Console UI 和 Apiserver 在 Kubernetes 集群内部的 Service DNS。

      配置 Helm Chart 选项 是否需要 cert-manager

      启用内部 SSL

      internalTLS=true

  2. 安装 cert-manager

    若使用自己的证书文件(ingress.tls.source=importation),您可以跳过此步骤。

    仅在使用 KubeSphere 生成的证书(ingress.tls.source=generation)或 Let’s Encrypt 颁发的证书(ingress.tls.source=letsEncrypt)时,才需要安装 cert-manager。

    # 添加 Jetstack Helm 仓库
    helm repo add jetstack https://charts.jetstack.io
    
    # 更新本地 Helm Chart 仓库缓存
    helm repo update
    
    # 安装 cert-manager Helm Chart
    helm install cert-manager jetstack/cert-manager -n cert-manager --create-namespace --set prometheus.enabled=false
    # 或
    kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/<VERSION>/cert-manager.yaml

    安装完 cert-manager 后,检查 cert-manager 命名空间中正在运行的 Pod 来验证它是否已正确部署:

    kubectl get pods --namespace cert-manager
  3. 根据您选择的证书选项,通过 Helm 为 KubeSphere 开启 SSL 配置

    1. 启用网关 SSL 配置

      • KubeSphere 生成的证书

        helm upgrade --install -n kubesphere-system --create-namespace ks-core $chart --version $version \
        --set ingress.enabled=true \
        --set hostname=kubesphere.my.org
      • Let’s Encrypt

        此选项使用 cert-manager 来自动请求和续订 Let’s Encrypt 证书。Let’s Encrypt 是免费的,而且是受信的 CA,因此可以提供有效的证书。

        helm upgrade --install -n kubesphere-system --create-namespace ks-core $chart --version $version \
        --set hostname=kubesphere.my.org \
        --set ingress.enabled=true \
        --set ingress.tls.source=letsEncrypt \
        --set letsEncrypt.email=me@example.org
      • 导入外部证书

        # 导入外部证书
        kubectl create secret tls tls-ks-core-ingress --cert=tls.crt --key=tls.key -n kubesphere-system
        
        # 安装 KubeSphere
        helm upgrade --install -n kubesphere-system --create-namespace ks-core
        $chart --version $version \
        --set ingress.enabled=true \
        --set hostname=kubesphere.my.org \
        --set ingress.tls.source=importation
    2. 启用内部服务 SSL 配置

      helm upgrade --install -n kubesphere-system --create-namespace ks-core
      $chart --version $version \
      --set internalTLS=true

配置 ratelimit 限流器

启用限流器之后,限流器会对所有用户的请求独立限流,主要支持以下两种方式:

  • 对 KubeSphere 中的每个用户设置限流速率,暂不支持独立设置每个用户的限流速率;

  • 对 KubeSphere 中的每个 ServiceAccount 独立设置限流速率。

启用限流器

启用限流器就是对 KubeSphere 中的每个用户设置限流速率。

  1. 修改 kubesphere-system 配置文件。

    kubectl -n kubesphere-system edit cm kubesphere-system

    新增以下内容:

    rateLimit:
      enable: true   # 启用限流器
      driver: memory # 内存模式
      QPS: 40.0      # 令牌恢复速率
      burst: 80      # 令牌桶容量
  2. 重启 ks-apiserver。

    kubectl -n kubesphere-system rollout restart deploy ks-apiserver

设置 ServiceAccount 限流器

设置前,您需要按照上一步启用限流器。然后执行以下命令对 ServiceAccount 设置限流速率。

kubectl -n <Namespace> patch serviceaccounts.kubesphere.io <ServiceAccount> --type merge -p '{"metadata": {"annotations": {"kubesphere.io/ratelimiter-qps": "20.0", "kubesphere.io/ratelimiter-burst": "40"}}}'

参数说明

选项 默认值 描述

rateLimit.enable

false

bool - 启用限流器。

rateLimit.driver

memory

string - 限流器存储类型,可选项:"memory"。

rateLimit.QPS

5.0

float32 - 限流器令牌桶算法中每秒恢复的令牌数。

rateLimit.burst

10

int - 限流器令牌桶算法中令牌桶的最大容量。

说明

令牌的恢复速率 QPS 建议设置为桶容量 burst 的一半。