在线场景openFuyao-system-controller手动部署指导
背景信息
本文档介绍在在线场景下,在一个未通过 BKE 自动部署 openFuyao-system-controller 的 Kubernetes 环境中,手动准备 patch-config、渲染并部署 openFuyao-system-controller,从而拉起 openFuyao 管理面组件。
在线场景中,openFuyao-system-controller 和管理面组件直接从在线镜像仓库拉取镜像,并从在线 Helm 仓库拉取 Chart。
前提条件
已准备以下机器:
| 角色 | 示例 IP | 用途 |
|---|---|---|
| 业务节点 | 192.168.200.216 | 已存在 Kubernetes 集群,手动部署 openFuyao-system-controller 并拉起管理面 |
机器硬件配置可参考快速入门中的配置要求。
已准备以下信息:
| 信息 | 用途 | 准备方式 |
|---|---|---|
openFuyao-system-controller.yaml | 部署业务集群 controller 组件 | 后续在 3 章节 从本机模板目录拷贝并渲染生成 |
VersionConfig-latest.yaml | latest 版本安装使用的组件版本配置 | 本文示例从 /bke/mount/source_registry/files/patches/VersionConfig-latest.yaml 读取 |
说明:
本文以latest版本为例。可通过版本配置文件确认当前版本:如果使用的是VersionConfig-latest.yaml,且文件中的openFuyaoVersion字段为latest,则为latest版本;如果使用的是Core-VersionConfig-v26.06-rc.1.yaml等指定版本配置文件,则为对应版本。非latest版本请将镜像 tag、Chart 仓库地址和版本配置文件替换为对应版本的实际值。
使用限制
需要在线安装,业务节点需能够访问以下地址:
- 在线镜像仓库:
cr.openfuyao.cn/openfuyao - 在线 Helm 仓库:
https://helm.openfuyao.cn/_core
使用教程
1. 检查目标环境
1.1 确认未安装管理面组件
在业务节点执行:
kubectl get ns openfuyao-system-controller openfuyao-system monitoring ingress-nginx
kubectl get deploy -A | grep -E "openfuyao|console|oauth|marketplace|monitoring"
kubectl get nodes如果 openfuyao-system-controller、openfuyao-system、monitoring、ingress-nginx 等命名空间或管理面组件已经存在,请先确认当前环境是否需要重新部署,避免覆盖已有管理面。
1.2 确认未安装 BKE/CAPI 控制面
kubectl get crd | grep -E "bke|cluster.x-k8s"
kubectl get pods -n cluster-system如果环境中没有 BKE/CAPI 相关 CRD,不能直接 apply BKECluster 类型资源。本文使用手动部署 openfuyao-system-controller 的方式安装管理面。
1.3 确认部署模板存在
ls /etc/openFuyao/addons/manifests/kubernetes/openfuyao-system-controller/latest/openfuyao-system-controller.yaml
grep -n "{{" /etc/openFuyao/addons/manifests/kubernetes/openfuyao-system-controller/latest/openfuyao-system-controller.yaml模板中通常包含如下变量,不能直接 apply:
{{ .repo }}
{{ .helmRepo }}
{{ .tagVersion }}2. 创建 patch-config
2.1 确认版本配置文件
在业务节点执行,确认用于创建 patch-config 的版本配置文件已存在:
ls /bke/mount/source_registry/files/patches/
grep -n "^openFuyaoVersion:" /bke/mount/source_registry/files/patches/VersionConfig-latest.yaml如果业务节点不存在 /bke/mount/source_registry/files/patches/VersionConfig-latest.yaml,请先将版本配置文件准备到该路径。本文以 latest 版本为例,可执行如下命令下载:
mkdir -p /bke/mount/source_registry/files/patches
curl -fLo /bke/mount/source_registry/files/patches/VersionConfig-latest.yaml \
https://openfuyao.obs.cn-north-4.myhuaweicloud.com/openFuyao/version-config/VersionConfig-latest.yaml如果 openFuyaoVersion 为 latest,可继续使用本文示例;如果是其他版本,请替换为对应版本配置文件,并同步替换后续命令中的文件名。
2.2 创建 namespace 和 ConfigMap
kubectl create ns openfuyao-system-controller --dry-run=client -o yaml | kubectl apply -f -
kubectl create cm patch-config \
-n openfuyao-system-controller \
--from-file=patch-data=/bke/mount/source_registry/files/patches/VersionConfig-latest.yaml \
--dry-run=client -o yaml | kubectl apply -f -
kubectl get cm patch-config -n openfuyao-system-controller3. 准备 openFuyao-system-controller YAML
3.1 拷贝部署模板
cp /etc/openFuyao/addons/manifests/kubernetes/openfuyao-system-controller/latest/openfuyao-system-controller.yaml /tmp/openfuyao-system-controller.yaml3.2 渲染在线参数
sed -i 's#{{ if .repo }}{{ .repo }}{{ else }}cr.openfuyao.cn/openfuyao/{{ end }}openfuyao-system-controller:{{ .tagVersion }}#cr.openfuyao.cn/openfuyao/openfuyao-system-controller:latest#g' /tmp/openfuyao-system-controller.yaml
sed -i 's#value: "{{ .repo }}"#value: "cr.openfuyao.cn/openfuyao"#g' /tmp/openfuyao-system-controller.yaml
sed -i 's#value: "{{ .helmRepo }}"#value: "https://helm.openfuyao.cn/_core"#g' /tmp/openfuyao-system-controller.yaml渲染后的关键配置如下:
image: cr.openfuyao.cn/openfuyao/openfuyao-system-controller:latest
OPENFUYAO_REGISTRY: cr.openfuyao.cn/openfuyao
HELM_REPORITORY_URL: https://helm.openfuyao.cn/_core检查模板变量是否已清理:
grep -n "{{" /tmp/openfuyao-system-controller.yaml如果无输出,表示模板变量已清理完成。
检查关键字段:
grep -nE "image:|OPENFUYAO_REGISTRY|HELM_REPORITORY_URL|entrypoint.sh" /tmp/openfuyao-system-controller.yaml
grep -nA2 "OPENFUYAO_REGISTRY\|HELM_REPORITORY_URL" /tmp/openfuyao-system-controller.yaml4. 部署 openFuyao-system-controller
在业务节点执行:
kubectl apply -f /tmp/openfuyao-system-controller.yaml
kubectl get pods -n openfuyao-system-controller -w当 Pod 处于 Init:0/1 时,表示 installer initContainer 正在执行安装流程。
查看安装日志:
kubectl logs -n openfuyao-system-controller deploy/openfuyao-system-controller -c installer -f日志中应能看到在线镜像仓库和在线 Helm 仓库地址:
cr.openfuyao.cn/openfuyao
https://helm.openfuyao.cn/_core5. 检查安装结果
5.1 查看全量组件
kubectl get pods -A5.2 查看管理面组件
kubectl get pods -n openfuyao-system
kubectl get pods -n ingress-nginx
kubectl get pods -n monitoring成功时核心组件应为 Running 或 Completed,包括:
console-serviceconsole-websitelocal-harbormarketplace-servicemonitoring-serviceoauth-serveroauth-webhookplugin-management-serviceuser-management-operatorweb-terminal-service
5.3 查看异常 Pod
kubectl get pods -A | grep -Ev "Running|Completed"如果无异常输出,表示 openFuyao-system-controller 及其拉起的管理面组件已部署完成。