跳转到内容

Dashboard 参考

Kubetail Dashboard 是一个基于 Go 的 HTTP 服务器,用于托管 Dashboard Web UI,并提供 Web UI 与 Kubernetes 集群交互所需的后端 API。服务器可执行文件由 Kubetail 仓库中 modules/dashboard 的源代码编译而成,通常通过 kubetail-dashboard Docker 镜像进行部署(见下文)。虽然也可以将 kubetail-dashboard 作为独立容器运行,但我们建议使用官方 Kubetail Helm Chart 进行部署。

kubetail-dashboard Docker 镜像会在每次发布时同步发布到 Docker Hub 和 GitHub Container Registry:

RegistryImage
Docker Hubkubetail/kubetail-dashboard
GHCRghcr.io/kubetail-org/kubetail-dashboard

有两个变体可用:

标签后缀基础镜像说明
(无)scratch最小镜像,占用最小
-alpinealpine包含 shell 和标准工具

默认容器入口点是 /dashboard/dashboard

终端窗口
dashboard [flags]
FlagShortDefaultDescription
--config-c配置文件路径(例如 /etc/kubetail/dashboard.yaml
--addr-a:8080要绑定的主机地址
--gin-modereleaseGin 框架模式 (release, debug)

Dashboard 可以使用 YAML、JSON 或 TOML 配置文件进行配置。通过 -c / --config 传入文件路径。配置文件中可以使用 ${VARIABLE_NAME} 语法引用环境变量。

终端窗口
dashboard --config /etc/kubetail/dashboard.yaml
## Kubetail Dashboard Configuration File
#
# 此文件定义 kubetail dashboard server 的行为,
# 它负责提供 Web UI 并为 dashboard 提供后端 API。
#
## allowed-namespaces ##
#
# dashboard 允许访问的 namespace 列表。
# 如果为空,则所有 namespace 都可访问。
#
# 默认值: []
#
allowed-namespaces: []
## allowed-origins ##
#
# 在 WebSocket 升级请求中接受的额外 origin(在 same-origin 之外)。
# 每一项必须是完整的 origin —— scheme://host[:port],不能包含路径。
# 比较时 host 不区分大小写,并会归一化默认端口(即 https://example.com
# 与 https://example.com:443 相匹配)。
#
# 当 dashboard 部署在反向代理之后,且代理重写了 Host 或终止了 TLS
# 而没有保留 scheme 时,请使用此选项 —— 否则直接基于 r.Host/r.TLS
# 进行 same-origin 匹配会拒绝合法的浏览器请求。请列出 dashboard
# 对外提供服务的 origin。
#
# 示例:
# - https://kubetail.example.com
# - https://kubetail.example.com:8443
#
# 默认值: []
#
allowed-origins: []
## kubeconfig ##
#
# Kubernetes API 请求使用的 kubeconfig 文件路径。
# 如果为空,则使用默认路径(~/.kube/config)或 KUBECONFIG 环境变量。
#
# 默认值: ""
#
kubeconfig: ""
## addr ##
#
# HTTP 服务器应绑定的网络地址和端口。
#
# 默认值: :8080
#
addr: ":8080"
## auth-mode ##
#
# dashboard 的认证模式。
# 有效值: auto, token
#
# 默认值: auto
#
auth-mode: auto
## base-path ##
#
# 所有 dashboard 端点的基础 URL 路径。
#
# 默认值: /
#
base-path: /
## cluster-api-endpoint ##
#
# Cluster API 服务器的 URL。
# 如果为空,则会禁用 Cluster API 集成。
#
# 默认值: ""
#
cluster-api-endpoint: ""
## environment ##
#
# dashboard 运行所在的环境。
# 有效值: desktop, cluster
#
# 默认值: cluster
#
environment: cluster
## gin-mode ##
#
# Gin 框架模式。
# 有效值: debug, release
#
# 默认值: release
#
gin-mode: release
## logging ##
#
# dashboard server 的日志输出配置
#
logging:
## enabled ##
#
# 是否为服务器启用 logging。
#
# 默认值: true
#
enabled: true
## level ##
#
# 要输出的最小日志级别。
# 有效值: debug, info, warn, error, disabled
#
# 默认值: info
#
level: info
## format ##
#
# 日志输出格式。
# 有效值: json, pretty
#
# 默认值: json
#
format: json
## access-log ##
#
# HTTP 访问日志配置
#
access-log:
## enabled ##
#
# 是否启用访问日志。
#
# 默认值: true
#
enabled: true
## hide-health-checks ##
#
# 是否在访问日志中省略健康检查请求 (/healthz)。
#
# 默认值: false
#
hide-health-checks: false
## session ##
#
# 会话管理设置
#
session:
## key-pairs ##
#
# 用于会话 cookie 的一个或多个签名/加密密钥对。第一个密钥对
# 用于生成新 cookie;其他密钥对仅用于读取,从而支持零停机
# 时间的密钥轮换。
#
# 每个密钥对包含:
# signing-key (必填)— 十六进制编码的 HMAC 签名密钥;建议使用 32 或 64 字节的原始字节
# encryption-key (可选)— 十六进制编码的 AES 加密密钥;可为 16、24 或 32 字节的原始字节
#
# 当此项为空且配置了 local-storage-dir 时,会在首次启动时
# 生成一个随机密钥对并持久化到磁盘。
#
key-pairs: []
## cookie ##
#
# 会话 cookie 配置
#
cookie:
## name ##
#
# 会话 cookie 的名称。
#
# 默认值: kubetail_dashboard_session
#
name: kubetail_dashboard_session
## path ##
#
# cookie 生效的 URL 路径。
#
# 默认值: /
#
path: /
## domain ##
#
# cookie 生效的域名。
# 如果为空,则 cookie 仅对当前域名有效。
#
# 默认值: ""
#
domain: ""
## max-age ##
#
# cookie 的最大存活时间(秒)。
#
# 默认值: 2592000 (30 days)
#
max-age: 2592000
## secure ##
#
# 是否仅通过 HTTPS 发送 cookie。
#
# 默认值: false
#
secure: false
## http-only ##
#
# 是否禁止 JavaScript 访问该 cookie。
#
# 默认值: true
#
http-only: true
## same-site ##
#
# cookie 的 SameSite 属性。
# 有效值: strict, lax, none
#
# 默认值: lax
#
same-site: lax
## tls ##
#
# HTTP 服务器的 TLS 配置
#
tls:
## enabled ##
#
# 是否启用 TLS。
#
# 默认值: false
#
enabled: false
## cert-file ##
#
# TLS 证书文件路径。
#
# 默认值: ""
#
cert-file: ""
## key-file ##
#
# TLS 私钥文件路径。
#
# 默认值: ""
#
key-file: ""
## ui ##
#
# UI 专用配置选项
#
ui:
## cluster-api-enabled ##
#
# 是否在 UI 中启用 Cluster API 集成。
#
# 默认值: true
#
cluster-api-enabled: true