集群组件
Zeabur Builder
从 Git 仓库构建镜像并存放在集群里,让服务可以从 Git 部署。
- 空闲时的内存
- 约 50 MiB
- CI 在应用就绪、还没有流量时测到的。实际使用会更多,记得留点余量。
- 测试过的服务器
- x86 和 ARM
- 默认是否安装
- 可选
简介
Zeabur Builder 用 Dockerfile 或 Railpack,从 Git 仓库和上传的文件夹构建容器镜像,并把镜像存在 zot 里。zot 是随组件一起安装的 OCI 镜像仓库,所以构建不需要外部仓库的账号。Zeabur 开源版要从 Git 部署服务,就需要它;没有它,服务只能从镜像部署。
Builder 会为每个要构建的 Namespace 运行一个 buildkitd。组件用 cert-manager 创建一个 CA,为 zot 签发证书。推送镜像需要 Builder 签发的短期 token。NetworkPolicy 只让 Builder、buildkitd 和构建 Pod 访问 zot。zot 每个仓库保留最近的 20 个 tag,镜像存在 20Gi 的卷上。
Builder 会读取、创建、更新和删除每个 Namespace 的 Secret(Git 凭据和复制出来的凭据),并管理那里的 Build、BuildRun 和 Job。每个 buildkitd 都有特权,并搭配 user namespace 和出站规则运行。
安装前准备
- 先安装 cert-manager,由它签发 zot 的证书。
- 节点用输入项
clusterIp的固定地址从 zot 拉镜像。这是集群 Service CIDR 里的一个空闲地址;留空时 Zeabur 会自动选一个。在 K3s、RKE2 和 KubeSolo 上,zot-nodeDaemonSet 会让每个节点改连这个地址,并把zot-tlsSecret 里的 CA 交给节点。其他发行版要自己在每个节点配置zot.zot.svc:5000指向这个地址的镜像仓库镜像,并信任这个 CA。
使用方法
在 Zeabur 开源版项目里选择新建 → 从 Git 部署,输入仓库。详见从 Git 构建并部署服务,同一页也说明上传文件夹。构建完成的镜像由 Keel 部署,所以也要安装 Keel。
移除
移除 Zeabur Builder 后,所有构建都会停止。zot 的卷和里面所有的镜像会保留,CRD 和所有 Build 也会保留。
移除前先确认没有服务还从 zot 拉镜像。zot 移除后,重启或迁移到其他节点的 Pod 就拉不到镜像。详见移除组件。
故障排除
zot 无法启动
zot 会等 Secret zot-tls 和 zot-token-signer 出现。执行 kubectl -n zot get certificate,pods。Certificate 没有就绪,就是 cert-manager 的问题。
服务拉不到镜像
Pod 停在 ImagePullBackOff。执行 kubectl describe pod <name> 查看事件。在 K3s、RKE2 和 KubeSolo 上,确认那个节点有一个在运行的 zot-node Pod,并且 /var/lib/rancher/k3s/agent/etc/containerd/certs.d/zot.zot.svc:5000/hosts.toml(RKE2 是 rancher/rke2,KubeSolo 是 /var/lib/kubesolo/containerd/registry/)写的是 clusterIp 的地址。
技术细节
这个版本
- 提供的功能
- builds
- 许可
- Apache-2.0
- 官方网站
- github.com
CI 测试结果
CI 会把这些文件原样装到新的集群,等到它就绪,再记下空闲时的内存用量。
| 发行版 | 平台 | Kubernetes | 通过日期 | 空闲内存 |
|---|---|---|---|---|
| k3s | linux/amd64 | v1.37.2 | 51 MiB | |
| k3s | linux/arm64 | v1.37.2 | 50 MiB | |
| kind | linux/amd64 | v1.37.0 | 51 MiB | |
| kind | linux/arm64 | v1.37.0 | 51 MiB | |
| kubesolo | linux/amd64 | v1.36.6 | 50 MiB | |
| kubesolo | linux/arm64 | v1.36.6 | 50 MiB | |
| rke2 | linux/amd64 | v1.37.2 | 51 MiB | |
| rke2 | linux/arm64 | v1.37.2 | 50 MiB |
安全性
Zeabur Builder: a ClusterRole that manages Builds, BuildRuns and Jobs in every namespace; reads Pods, Namespaces and ServiceAccounts; reads, creates, updates and deletes Secrets in every namespace (the Git credentials Builds name, and the copies it puts in build namespaces), and reads the zot token signer. Runs one privileged buildkitd per building namespace in its own namespace, with a user namespace and an egress policy. An admission policy limits the Jobs and StatefulSets it can create. zot: no RBAC, a ServiceAccount without roles; serves the OCI registry API over TLS on port 5000 inside the cluster. zot-node: a DaemonSet that runs as root on every node, without capabilities, and writes zot's address and CA into the container runtime's registry directory under /var/lib.
会安装的内容
- tls
- zot 0.1.134
- builder 0.3.0
需要
- 任一个提供 certificates 的组件