Skip to content

Latest commit

 

History

History
126 lines (91 loc) · 3.1 KB

deploy.md

File metadata and controls

126 lines (91 loc) · 3.1 KB

LiteBoxd Deployment Guide (via liteboxd-installer)

本文说明如何通过 liteboxd-installer 一键部署 LiteBoxd。 Longhorn 专项配置可参考 docs/user/longhorn.md。 如果你要启用持久化 rootfs 沙箱,建议同时启用 Longhorn。

1. 前置条件

  • 控制机可以 SSH 登录 master 节点
  • master 节点可以访问所有 agent 节点的 SSH 端口
  • agent 节点可以是内网 IP(installer 会通过 master 跳转连接)
  • 准备好各节点 root 密码(建议环境变量注入)

2. 构建 installer

在仓库根目录执行:

make build-installer

生成二进制:

bin/liteboxd-installer

3. 准备配置文件

推荐从示例复制一份再修改:

cp tools/liteboxd-installer/examples/install.example.yaml /tmp/liteboxd-install.yaml

至少需要按你的环境修改这些字段:

  • cluster.master.host / cluster.master.nodeIP
  • cluster.agents[](可为空)
  • cluster.master.password / cluster.agents[].password
  • liteboxd.ingressHost
  • liteboxd.images.api/gateway/web
  • liteboxd.configDir(LiteBoxd kustomize patch 目录)
  • storage.longhorn.enabled(是否由 installer 自动安装 Longhorn)

Longhorn 推荐配置(单机/测试环境):

storage:
  longhorn:
    enabled: true
    namespace: "longhorn-system"
    releaseName: "longhorn"
    chartRepoURL: "https://charts.longhorn.io"
    defaultReplicaCount: 1
    setDefaultStorageClass: true
    helmInstallScriptURL: "https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3"

4. 设置密码环境变量

export MASTER_PASS='your-master-password'
export AGENT1_PASS='your-agent1-password'
export AGENT2_PASS='your-agent2-password'

5. 执行部署

./bin/liteboxd-installer -f /tmp/liteboxd-install.yaml apply

常用参数:

  • --log-file /tmp/liteboxd-installer.log:输出详细执行日志
  • --state /tmp/liteboxd-state.json:指定状态文件位置
  • --dry-run:只打印计划,不真正执行
  • --cluster-only:仅维护 K3s/Cilium/Longhorn/节点,不部署 LiteBoxd

示例:

./bin/liteboxd-installer \
  -f /tmp/liteboxd-install.yaml \
  --log-file /tmp/liteboxd-installer.log \
  apply

6. 失败重试

如果中断或失败,可直接重试:

./bin/liteboxd-installer -f /tmp/liteboxd-install.yaml resume

7. 扩缩容与节点移除

  • 扩容:更新 cluster.agents 后重新执行 apply
  • 删除节点:
./bin/liteboxd-installer \
  -f /tmp/liteboxd-install.yaml \
  node remove --hosts 10.10.10.13

8. 说明

  • installer 为幂等设计,重复执行 apply 是预期用法
  • Cilium 配置未变化时会跳过安装/升级步骤,避免不必要网络抖动
  • Longhorn 配置未变化时会跳过安装/升级步骤
  • storage.longhorn.enabled=true 时,installer 会自动处理各节点 open-iscsi 依赖

9. Longhorn 部署后检查

kubectl get sc
kubectl -n longhorn-system get pods

预期:

  • 可看到 longhorn StorageClass
  • longhorn-system 命名空间内核心组件处于 Running/Ready