KubeOS/0002-docs-update-kbimg-docs.patch
Yuhang Wei a82fa3bcaa KubeOS: sync from upstream
Signed-off-by: Yuhang Wei <weiyuhang3@huawei.com>
2024-12-03 20:55:16 +08:00

1210 lines
39 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 63d4c8914090ac3fdb24ddc2b43dbd44795a5f95 Mon Sep 17 00:00:00 2001
From: Yuhang Wei <weiyuhang3@huawei.com>
Date: Wed, 27 Nov 2024 17:31:43 +0800
Subject: [PATCH 02/11] docs: update kbimg docs
Signed-off-by: Yuhang Wei <weiyuhang3@huawei.com>
---
docs/quick-start.md | 33 +-
...275\234\346\214\207\345\257\274-binary.md" | 469 +++++++++++++++++
...75\234\346\214\207\345\257\274-scripts.md" | 169 ++++++
...66\344\275\234\346\214\207\345\257\274.md" | 485 ------------------
4 files changed, 641 insertions(+), 515 deletions(-)
create mode 100644 "docs/user_guide/KubeOS\351\225\234\345\203\217\345\210\266\344\275\234\346\214\207\345\257\274-binary.md"
create mode 100644 "docs/user_guide/KubeOS\351\225\234\345\203\217\345\210\266\344\275\234\346\214\207\345\257\274-scripts.md"
delete mode 100644 "docs/user_guide/\345\256\271\345\231\250OS\351\225\234\345\203\217\345\210\266\344\275\234\346\214\207\345\257\274.md"
diff --git a/docs/quick-start.md b/docs/quick-start.md
index 1d59048e..599b17b6 100644
--- a/docs/quick-start.md
+++ b/docs/quick-start.md
@@ -112,41 +112,14 @@
* 请确保os-agent属主和属组为root建议os-agent文件权限为500
* 容器OS虚拟机镜像制作
- 进入scripts目录执行脚本
+ 在KubeOS项目根目录下执行
```shell
- cd scripts
- bash kbimg.sh create vm-image -p xxx.repo -v v1 -b ../bin/os-agent -e '''$1$xyz$RdLyKTL32WEvK3lg8CXID0'''
+ cargo run --package kbimg -- create -f KubeOS-Rust/kbimg/kbimg.toml vm-img
```
- 参数说明如下:
-
- ```bash
- Usage : kbimg create vm-image -p iso-path -v os-version -b os-agent-dir -e os-password
- or
- kbimg create vm-image -d repository/name:tag
-
- options:
- -p repo path
- -v KubeOS version
- -b path of os-agent binary
- -e os encrypted password
- -d docker image like repository/name:tag
- -l boot to legacy BIOS mode, if not specify, then UEFI mode
- -h,--help show help information
- ```
-
- * 其中 xxx.repo 为制作镜像所需要的 yum 源yum 源建议配置为 openEuler 具体版本的 everything 仓库和 EPOL 仓库。
- * 容器 OS 镜像制作完成后,会在 scripts 目录下生成:
- * raw格式的系统镜像system.imgsystem.img大小默认为20G支持的根文件系统分区大小<2020MiB持久化分区<16GB。
- * qcow2 格式的系统镜像 system.qcow2。
- * 可用于升级的根文件系统分区镜像 update.img 。
- * 制作出来的容器 OS 虚拟机镜像目前只能用于 CPU 架构为 x86 和 AArch64 的虚拟机场景。若x86 架构的虚拟机需要使用 legacy 启动模式,需制作镜像时指定-l参数
- * 默认root密码为openEuler12#$
- * 您可通过`openssl passwd -6 -salt $(head -c18 /dev/urandom | openssl base64)`命令生成root密码并通过`-e`参数配置密码
- * 容器OS运行底噪<150M (不包含k8s组件及相关依赖kubernetes-kubeadmkubernetes-kubelet containernetworking-pluginssocatconntrack-toolsebtablesethtool)
+ 详细配置文件和命令行参数说明请见[KubeOS镜像制作指导](../docs/user_guide/KubeOS镜像制作指导-binary.md):
* 本项目不提供容器OS镜像仅提供裁剪工具裁剪出来的容器OS内部的安全性由OS发行商保证。
- * 详细参数说明请见[《容器OS镜像制作指导》](../docs/user_guide/%E5%AE%B9%E5%99%A8OS%E9%95%9C%E5%83%8F%E5%88%B6%E4%BD%9C%E6%8C%87%E5%AF%BC.md)
* 声明: os-agent使用本地unix socket进行通信因此不会新增端口。下载镜像的时候会新增一个客户端的随机端口1024~65535使用完后关闭。proxy和operator与api-server通信时作为客户端也会有一个随机端口基于kubernetes的operator框架必须使用端口。他们部署在容器里。
diff --git "a/docs/user_guide/KubeOS\351\225\234\345\203\217\345\210\266\344\275\234\346\214\207\345\257\274-binary.md" "b/docs/user_guide/KubeOS\351\225\234\345\203\217\345\210\266\344\275\234\346\214\207\345\257\274-binary.md"
new file mode 100644
index 00000000..b951b388
--- /dev/null
+++ "b/docs/user_guide/KubeOS\351\225\234\345\203\217\345\210\266\344\275\234\346\214\207\345\257\274-binary.md"
@@ -0,0 +1,469 @@
+# KubeOS镜像制作说明
+
+## 简介
+
+kbimg是使用Rust语言编写的二进制工具通过解析用户的[toml配置文件](#详细toml配置文件示例)动态生成脚本制作KubeOS虚拟机镜像、PXE物理机镜像、升级镜像和admin容器镜像。
+
+## 命令介绍
+
+kbimg - CLI tool for generating various types of image for KubeOS
+
+```text
+Usage: kbimg [OPTIONS] <COMMAND>
+
+Commands:
+ create Create a new KubeOS image
+ help Print this message or the help of the given subcommand(s)
+
+Options:
+ -d, --debug Enable debug mode, generate the scripts without execution
+ -h, --help Print help
+ -V, --version Print version
+```
+
+kbimg-create - Create a new KubeOS image
+
+```text
+Usage: kbimg create --file <FILE> <IMAGE_TYPE>
+
+Arguments:
+ <IMAGE_TYPE> [possible values: vm-img, pxe-img, upgrade-img, admin-container]
+
+Options:
+ -f, --file <FILE> Path to the toml configuration file
+ -h, --help Print help
+```
+
+## 注意事项
+
+* 请确保已安装`qemu-img bc parted tar yum docker dosfstools`
+* 制作启用dm-verity功能的镜像需要安装`pesign nss openssl veritysetup crypto-policies`
+* KubeOS镜像制作需要使用root权限
+* 制作镜像时提供的 repo 文件中yum 源建议同时配置 openEuler 具体版本的 everything 仓库和 EPOL 仓库
+* KubeOS镜像制作之前需要先将当前机器上的selinux关闭或者设为允许模式
+* 使用默认rpmlist进行KubeOS镜像制作至少需要有25G的剩余空间
+* KubeOS镜像制作工具执行异常中断可能会残留文件、目录或挂载需用户手动清理对于可能残留的rootfs目录该目录虽然权限为555但容器OS镜像制作在开发环境进行不会对生产环境产生影响
+* 请确保os-agent属主和属组为root建议os-agent文件权限为500
+
+## 配置文件说明
+
+### from_repo
+
+从 repo 创建升级容器镜像、虚拟机镜像或PXE物理机镜像
+
+ | 参数 | 描述 |
+ | --- | --- |
+ | agent_path | os-agent 二进制的路径 |
+ | legacy_bios | 镜像为 legacy 引导或 UEFI 引导 |
+ | repo_path | repo 文件的路径repo 文件中配置制作镜像所需要的 yum 源 |
+ | root_passwd | root 用户密码,与/etc/shadow文件内密码格式一致可使用`openssl passwd -6 -salt $(head -c18 /dev/urandom \| openssl base64)`命令生成 |
+ | version | KubeOS 镜像的版本,将写入/etc/os-release文件内作为OS标识 |
+ | rpmlist | 期望安装进镜像内的rpm包列表 |
+ | upgrade_img | [OPTIONAL]指定生成的升级容器镜像的镜像名(制作升级容器镜像必需) |
+
+### admin_container
+
+制作admin运维容器
+
+ | 参数 | 描述 |
+ | --- | --- |
+ | hostshell | hostshell二进制路径可在项目根目录下通过`make hostshell`编译 |
+ | img_name | 指定生成的容器镜像名 |
+
+### pxe_config
+
+在制作PXE物理机镜像时配置该参数用于PXE安装。制作PXE物理机镜像时必需。
+
+ | 参数 | 描述 |
+ | --- | --- |
+ | server_ip | 用于下载根文件系统 tar 包的 HTTP 服务器地址 |
+ | rootfs_name | 放置于 HTTP 服务器的文件系统 tar 包名称 |
+ | disk | 安装 KubeOS 系统的目标磁盘名 |
+ | route_ip | 配置目标机器网卡的路由 IP |
+ | dhcp | [OPTIONAL] 默认为 false启用 DHCP 模式配置网络 |
+ | local_ip | [OPTIONAL] 配置目标机器网卡的 IPdhcp 为 false 时必需 |
+ | net_name | [OPTIONAL] 配置目标机器网卡名dhcp 为 false 时必需 |
+ | netmask | [OPTIONAL] 配置目标机器网卡的子网掩码dhcp 为 false 时必需 |
+
+### users
+
+[OPTIONAL] 添加用户
+
+ | 参数 | 描述 |
+ | --- | --- |
+ | name | 用户名 |
+ | passwd | 密码 |
+ | primary_groups | [OPTIONAL] 用户主组 |
+ | groups | [OPTIONAL] 用户附加组 |
+
+### copy_files
+
+[OPTIONAL] 拷贝文件到rootfs内指定目录
+
+ | 参数 | 描述 |
+ | --- | --- |
+ | dst | 目标路径 |
+ | src | 源文件路径 |
+ | create_dir | [OPTIONAL]拷贝前创建文件夹 |
+
+### grub
+
+[OPTIONAL] grub配置配置dm-verity时必需
+
+ | 参数 | 描述 |
+ | --- | --- |
+ | passwd | grub 密码 |
+
+### systemd_service
+
+[OPTIONAL] 新增 systemd 服务
+
+ | 参数 | 描述 |
+ | --- | --- |
+ | name | systemd 服务名 |
+
+### chroot_script
+
+[OPTIONAL] 自定义 chroot 脚本
+
+ | 参数 | 描述 |
+ | --- | --- |
+ | path | 脚本路径 |
+ | rm | [OPTIONAL]执行完毕后是否删除该脚本 |
+
+### disk_partition
+
+[OPTIONAL] 自定义分区大小和镜像大小
+
+ | 参数 | 描述 |
+ | --- | --- |
+ | root | root分区大小, 单位为MiB |
+ | img_size | [OPTIONAL]镜像大小单位为GB |
+
+### persist_mkdir
+
+[OPTIONAL] persist 分区新建目录
+
+ | 参数 | 描述 |
+ | --- | --- |
+ | name | 目录名 |
+
+### dm_verity
+
+[OPTIONAL] 制作启用dm-verity功能的虚拟机或升级镜像
+
+ | 参数 | 描述 |
+ | --- | --- |
+ | efi_key | efi明文口令 |
+ | grub_key | grub明文口令 |
+ | keys_dir |[OPTIONAL]可指定密钥文件夹,复用先前制作镜像创建的密钥 |
+
+## 使用示例
+
+### KubeOS 虚拟机镜像制作
+
+* 支持CPU 架构为 x86 和 aarch64 的虚拟机场景。若x86架构的虚拟机需要使用 legacy 启动模式,请在`[from_repo]`下配置`legacy_bios`为`true`
+* `repo_path`为制作镜像所需要的 yum 源文件路径yum 源建议配置为 openEuler 具体版本的 everything 仓库和 EPOL 仓库。
+* 默认root密码为openEuler12#$
+* 容器OS运行底噪<150M (不包含k8s组件及相关依赖`kubernetes-kubeadmkubernetes-kubelet containernetworking-pluginssocatconntrack-toolsebtablesethtool`)
+
+* 配置文件示例
+
+```toml
+[from_repo]
+agent_path = "./bin/rust/release/os-agent"
+legacy_bios = false
+repo_path = "/etc/yum.repos.d/openEuler.repo"
+root_passwd = "$1$xyz$RdLyKTL32WEvK3lg8CXID0" # default passwd: openEuler12#$
+rpmlist = [
+ "NetworkManager",
+ "cloud-init",
+ "conntrack-tools",
+ "containerd",
+ "containernetworking-plugins",
+ "cri-tools",
+ "dhcp",
+ "ebtables",
+ "ethtool",
+ "iptables",
+ "kernel",
+ "kubernetes-kubeadm",
+ "kubernetes-kubelet",
+ "openssh-server",
+ "passwd",
+ "rsyslog",
+ "socat",
+ "tar",
+ "vi",
+]
+version = "v1"
+```
+
+* 结果说明
+容器 OS 镜像制作完成后,会在 ./scripts-auto 目录下生成
+ * system.qcow2: qcow2 格式的系统镜像,大小默认为 20GiB支持的根文件系统分区大小 < 2560 MiB持久化分区 < 15GB 。
+ * system.img: img 格式的系统镜像,大小默认为 20GiB支持的根文件系统分区大小 < 2560 MiB持久化分区 < 15GB 。
+ * kubeos.tar: 用于升级的根文件系统tar包
+
+### KubeOS 升级容器镜像制作
+
+* 制作KubeOS容器镜像
+
+```toml
+[from_repo]
+agent_path = "./bin/rust/release/os-agent"
+legacy_bios = false
+repo_path = "/etc/yum.repos.d/openEuler.repo"
+root_passwd = "$1$xyz$RdLyKTL32WEvK3lg8CXID0" # default passwd: openEuler12#$
+rpmlist = [
+ "NetworkManager",
+ "cloud-init",
+ "conntrack-tools",
+ "containerd",
+ "containernetworking-plugins",
+ "cri-tools",
+ "dhcp",
+ "ebtables",
+ "ethtool",
+ "iptables",
+ "kernel",
+ "kubernetes-kubeadm",
+ "kubernetes-kubelet",
+ "openssh-server",
+ "passwd",
+ "rsyslog",
+ "socat",
+ "tar",
+ "vi",
+]
+upgrade_img = "kubeos-upgrade:v1"
+version = "v1"
+```
+
+* 制作完成后,通过`docker images`查看制作出来的KubeOS容器镜像
+
+### KubeOS PXE物理机安装所需镜像及文件制作
+
+* 支持CPU 架构为 x86 和 aarch64 的物理机场景不支持legacy引导模式
+* PXE物理机镜像制作不支持dm-verity功能
+* 首先需要修改```kbimg.toml```中```pxe_config```的配置,对相关参数进行配置,详细参数可见[参数说明](#pxe_config)ip目前仅支持ipv4配置示例如下
+
+ ```toml
+ [pxe_config]
+ dhcp = false
+ # rootfs file name
+ rootfs_name = "kubeos.tar"
+ # select the target disk to install kubeOS
+ disk = "/dev/vda"
+ # pxe server ip address where stores the rootfs on the http server
+ server_ip = "192.168.122.50"
+ # target machine ip
+ local_ip = "192.168.122.100"
+ # target machine route
+ route_ip = "192.168.122.1"
+ # target machine netmask
+ netmask = "255.255.255.0"
+ # target machine netDevice name
+ net_name = "eth0"
+ ```
+
+* 如需进行DNS配置请先自定义```resolv.conf```文件,并启用```copy_files```字段将配置文件拷贝到```/etc```目录
+
+ ```toml
+ [[copy_files]]
+ dst = "/etc"
+ src = "<path to resolv.conf>"
+ ```
+
+* KubeOS物理机安装所需镜像制作及pxe_config配置全示例
+
+ ```toml
+ [from_repo]
+ agent_path = "./bin/rust/release/os-agent"
+ legacy_bios = false
+ repo_path = "/etc/yum.repos.d/openEuler.repo"
+ root_passwd = "$1$xyz$RdLyKTL32WEvK3lg8CXID0" # default passwd: openEuler12#$
+ rpmlist = [
+ "NetworkManager",
+ "cloud-init",
+ "conntrack-tools",
+ "containerd",
+ "containernetworking-plugins",
+ "cri-tools",
+ "dhcp",
+ "ebtables",
+ "ethtool",
+ "iptables",
+ "kernel",
+ "kubernetes-kubeadm",
+ "kubernetes-kubelet",
+ "openssh-server",
+ "passwd",
+ "rsyslog",
+ "socat",
+ "tar",
+ "vi",
+ "coreutils",
+ "dosfstools",
+ "dracut",
+ "gawk",
+ "hwinfo",
+ "net-tools",
+ "parted",
+ ]
+ version = "v1"
+
+ [pxe_config]
+ dhcp = true
+ rootfs_name = "kubeos.tar"
+ disk = "/dev/vda"
+ server_ip = "192.168.122.50"
+ route_ip = "192.168.122.1"
+ #local_ip = "192.168.1.100"
+ #netmask = "255.255.255.0"
+ #net_name = "eth0"
+ ```
+
+* 结果说明
+ * initramfs.img: 用于pxe启动用的 initramfs 镜像
+ * kubeos.tar: pxe安装所用的根分区文件系统
+
+### admin运维容器镜像制作
+
+* 首先在KubeOS项目根目录下执行`make hostshell`命令编译hostshell二进制
+* 在toml配置文件内填入以下示例配置制作admin运维容器镜像
+
+```toml
+[admin_container]
+img_name = "kubeos-admin-container:v1"
+hostshell = "./bin/hostshell"
+```
+
+* 制作完成后,通过`docker images`查看制作出来的KubeOS容器镜像
+
+## 使用说明
+
+### 使用cloud-init在KubeOS启动时初始化
+
+在`[from_repo]`配置内的`rpmlist`中,配置`cloud-init`包可在KubeOS启动时使用`cloud-init`进行初始化。
+若用户需要覆盖默认的cloud-init配置可配置如下示例
+
+ ```toml
+ [[copy_files]]
+ dst = "/etc/cloud"
+ src = "./cloud.cfg"
+ ```
+
+### 创建systemd服务
+
+* 新增 systemd 服务需要将对应的 .service 文件或 .mount 文件拷贝至镜像```/etc/systemd/system```目录下
+
+ ```toml
+ [[copy_files]]
+ dst = "/etc/systemd/system"
+ src = "./containerd.service"
+
+ [systemd_service]
+ name = ["containerd"]
+ ```
+
+## 附录
+
+### 详细toml配置文件示例
+
+请根据需求和[配置文件说明](#配置文件说明),修改如下示例配置文件,生成所需镜像。
+
+```toml
+[from_repo]
+agent_path = "./bin/rust/release/os-agent"
+legacy_bios = false
+repo_path = "/etc/yum.repos.d/openEuler.repo"
+root_passwd = "$1$xyz$RdLyKTL32WEvK3lg8CXID0" # default passwd: openEuler12#$, use "openssl passwd -6 -salt $(head -c18 /dev/urandom | openssl base64)" to generate your passwd
+rpmlist = [
+ "NetworkManager",
+ "cloud-init",
+ "conntrack-tools",
+ "containerd",
+ "containernetworking-plugins",
+ "cri-tools",
+ "dhcp",
+ "ebtables",
+ "ethtool",
+ "iptables",
+ "kernel",
+ "kubernetes-kubeadm",
+ "kubernetes-kubelet",
+ "openssh-server",
+ "passwd",
+ "rsyslog",
+ "socat",
+ "tar",
+ "vi",
+ # Below packages are required for pxe-image. Uncomment them if you want to generate pxe-image.
+ # "coreutils",
+ # "dosfstools",
+ # "dracut",
+ # "gawk",
+ # "hwinfo",
+ # "net-tools",
+ # "parted",
+]
+upgrade_img = "kubeos-upgrade:v1"
+version = "v1"
+
+# [admin_container]
+# img_name = "kubeos-admin-container:v1"
+# hostshell = "./bin/hostshell"
+
+# [pxe_config]
+# dhcp = false
+# disk = "/dev/vda"
+# local_ip = "192.168.1.100"
+# net_name = "eth0"
+# netmask = "255.255.255.0"
+# rootfs_name = "kubeos.tar"
+# route_ip = "192.168.1.1"
+# server_ip = "192.168.1.50"
+
+# [[users]]
+# groups = ["admin", "wheel"]
+# name = "foo"
+# passwd = "foo"
+# primary_group = "foo"
+
+# [[users]]
+# groups = ["example"]
+# name = "bar"
+# passwd = "bar"
+
+# [[copy_files]]
+# create_dir = "/root/test"
+# dst = "/root/test/foo.txt"
+# src = "/root/KubeOS/foo.txt"
+
+# [[copy_files]]
+# dst = "/etc/bar.txt"
+# src = "../bar.txt"
+
+# [grub]
+# passwd = "foo"
+
+# [systemd_service]
+# name = ["containerd", "kubelet"]
+
+# [chroot_script]
+# path = "./my_chroot.sh"
+# rm = true
+
+# [disk_partition]
+# img_size = 30 # GB
+# root = 3000 # MiB
+
+# [persist_mkdir]
+# name = ["bar", "foo"]
+
+# [dm_verity]
+# efi_key = "foo"
+# grub_key = "bar"
+# keys_dir = "./keys"
+```
diff --git "a/docs/user_guide/KubeOS\351\225\234\345\203\217\345\210\266\344\275\234\346\214\207\345\257\274-scripts.md" "b/docs/user_guide/KubeOS\351\225\234\345\203\217\345\210\266\344\275\234\346\214\207\345\257\274-scripts.md"
new file mode 100644
index 00000000..2b147107
--- /dev/null
+++ "b/docs/user_guide/KubeOS\351\225\234\345\203\217\345\210\266\344\275\234\346\214\207\345\257\274-scripts.md"
@@ -0,0 +1,169 @@
+# KubeOS镜像制作指导
+
+## 简介
+
+kbimg.sh是KubeOS部署和升级所需的镜像制作工具可以使用kbimg.sh制作KubeOS 容器,虚拟机和物理机镜像
+
+## 命令介绍
+
+### 命令格式
+
+**bash kbimg.sh** \[ --help | -h \] create \[ COMMANDS \] \[ OPTIONS \]
+
+### 参数说明
+
+* COMMANDS
+
+ | 参数 | 描述 |
+ |------------------------------| ---------------------------------------------- |
+ | upgrade-image | 生成用于安装和升级的OCI镜像格式的 KubeOS 镜像 |
+ | vm-image | 生成用于部署和升级的虚拟机镜像 |
+ | pxe-image | 生成物理机安装所需的镜像及文件 |
+
+* OPTIONS
+
+ | 参数 | 描述 |
+ | ------------ | ------------------------------------------------------------ |
+ | -p | repo 文件的路径repo 文件中配置制作镜像所需要的 yum 源 |
+ | -v | 制作出来的KubeOS镜像的版本 |
+ | -b | os-agent二进制的路径 |
+ | -e | KubeOS 镜像 root 用户密码,加密后的带盐值的密码,可以用 opensslkiwi 命令生成 |
+ | -d | 生成或者使用的 docke r镜像 |
+ | -l | 如果指定参数则镜像为legacy引导不指定默认是UEFI引导 |
+ | -h --help | 查看帮助信息 |
+
+## 使用说明
+
+### 注意事项
+
+* kbimg.sh 执行需要 root 权限
+* 当前仅支持 x86和 AArch64 架构使用
+* 容器 OS 镜像制作工具的 rpm 包源为 openEuler 具体版本的 everything 仓库和 EPOL 仓库。制作镜像时提供的 repo 文件中yum 源建议同时配置 openEuler 具体版本的 everything 仓库和 EPOL 仓库
+
+### KubeOS OCI 镜像制作
+
+#### 注意事项
+
+* 制作的 OCI 镜像仅用于后续的虚拟机/物理机镜像制作或升级使用,不支持启动容器
+* 使用默认 rpmlist 进行容器OS镜像制作时所需磁盘空间至少为6G如自已定义 rpmlist 可能会超过6G
+
+#### 使用示例
+
+* 如需进行DNS配置请先在```scripts```目录下自定义```resolv.conf```文件
+
+```shell
+ cd /opt/kubeOS/scripts
+ touch resolv.conf
+ vim resolv.conf
+```
+
+* 制作KubeOS容器镜像
+
+``` shell
+cd /opt/kubeOS/scripts
+bash kbimg.sh create upgrade-image -p xxx.repo -v v1 -b ../bin/os-agent -e '''$1$xyz$RdLyKTL32WEvK3lg8CXID0''' -d your_imageRepository/imageName:version
+```
+
+* 制作完成后查看制作出来的KubeOS容器镜像
+
+``` shell
+docker images
+```
+
+### KubeOS 虚拟机镜像制作
+
+#### 注意事项
+
+* 如使用 docker 镜像制作请先拉取相应镜像或者先制作docker镜像并保证 docker 镜像的安全性
+* 制作出来的容器 OS 虚拟机镜像目前只能用于 CPU 架构为 x86 和 AArch64 的虚拟机
+* 容器 OS 目前不支持 x86 架构的虚拟机使用 legacy 启动模式启动
+* 使用默认rpmlist进行容器OS镜像制作时所需磁盘空间至少为25G如自已定义rpmlist可能会超过25G
+
+#### 使用示例
+
+* 使用repo源制作
+ * 如需进行DNS配置请先在```scripts```目录下自定义```resolv.conf```文件
+
+ ```shell
+ cd /opt/kubeOS/scripts
+ touch resolv.conf
+ vim resolv.conf
+ ```
+
+ * KubeOS虚拟机镜像制作
+
+ ``` shell
+ cd /opt/kubeOS/scripts
+ bash kbimg.sh create vm-image -p xxx.repo -v v1 -b ../bin/os-agent -e '''$1$xyz$RdLyKTL32WEvK3lg8CXID0'''
+ ```
+
+* 使用docker镜像制作
+
+ ``` shell
+ cd /opt/kubeOS/scripts
+ bash kbimg.sh create vm-image -d your_imageRepository/imageName:version
+ ```
+
+* 结果说明
+ 容器 OS 镜像制作完成后,会在 /opt/kubeOS/scripts 目录下生成:
+ * system.qcow2: qcow2 格式的系统镜像,大小默认为 20GiB支持的根文件系统分区大小 < 2020 MiB持久化分区 < 16GiB 。
+ * update.img: 用于升级的根文件系统分区镜像
+
+### KubeOS 物理机安装所需镜像及文件制作
+
+#### 注意事项
+
+* 如使用 docker 镜像制作请先拉取相应镜像或者先制作 docker 镜像,并保证 docker 镜像的安全性
+* 制作出来的容器 OS 物理安装所需的镜像目前只能用于 CPU 架构为 x86 和 AArch64 的物理机安装
+* Global.cfg配置中指定的ip为安装时使用的临时ip,请在系统安装启动后请参考《openEuler 22.09 管理员指南-配置网络》进行网络配置
+* 不支持多个磁盘都安装KubeOS可能会造成启动失败或挂载紊乱
+* 容器OS 目前不支持 x86 架构的物理机使用 legacy 启动模式启动
+* 使用默认rpmlist进行镜像制作时所需磁盘空间至少为5G如自已定义 rpmlist 可能会超过5G
+
+#### 使用示例
+
+* 首先需要修改```00bootup/Global.cfg```的配置对相关参数进行配置参数均为必填ip目前仅支持ipv4配置示例如下
+
+ ```shell
+ # rootfs file name
+ rootfs_name=kubeos.tar
+ # select the target disk to install kubeOS
+ disk=/dev/sda
+ # pxe server ip address where stores the rootfs on the http server
+ server_ip=192.168.1.50
+ # target machine temporary ip
+ local_ip=192.168.1.100
+ # target machine temporary route
+ route_ip=192.168.1.1
+ # target machine temporary netmask
+ netmask=255.255.255.0
+ # target machine netDevice name
+ net_name=eth0
+ ```
+
+* 使用 repo 源制作
+ * 如需进行DNS配置请在```scripts```目录下自定义```resolv.conf```文件
+
+ ```shell
+ cd /opt/kubeOS/scripts
+ touch resolv.conf
+ vim resolv.conf
+ ```
+
+ * KubeOS物理机安装所需镜像制作
+
+ ```shell
+ cd /opt/kubeOS/scripts
+ bash kbimg.sh create pxe-image -p xxx.repo -v v1 -b ../bin/os-agent -e '''$1$xyz$RdLyKTL32WEvK3lg8CXID0'''
+ ```
+
+* 使用 docker 镜像制作
+
+ ``` shell
+ cd /opt/kubeOS/scripts
+ bash kbimg.sh create pxe-image -d your_imageRepository/imageName:version
+ ```
+
+* 结果说明
+ * initramfs.img: 用于pxe启动用的 initramfs 镜像
+ * kubeos.tar: pxe安装所用的 OS
diff --git "a/docs/user_guide/\345\256\271\345\231\250OS\351\225\234\345\203\217\345\210\266\344\275\234\346\214\207\345\257\274.md" "b/docs/user_guide/\345\256\271\345\231\250OS\351\225\234\345\203\217\345\210\266\344\275\234\346\214\207\345\257\274.md"
deleted file mode 100644
index d54cc837..00000000
--- "a/docs/user_guide/\345\256\271\345\231\250OS\351\225\234\345\203\217\345\210\266\344\275\234\346\214\207\345\257\274.md"
+++ /dev/null
@@ -1,485 +0,0 @@
-# 容器OS镜像制作指导
-
-## 简介
-
-kbimg是KubeOS部署和升级所需的镜像制作工具可以使用kbimg制作KubeOS 容器,虚拟机和物理机镜像
-
-## 命令介绍
-
-### 命令格式
-
-**bash kbimg.sh** \[ --help | -h \] create \[ COMMANDS \] \[ OPTIONS \]
-
-### 参数说明
-
-* COMMANDS
-
- | 参数 | 描述 |
- |------------------------------| ---------------------------------------------- |
- | upgrade-image | 生成用于安装和升级的OCI镜像格式的 KubeOS 镜像 |
- | vm-image | 生成用于部署和升级的虚拟机镜像 |
- | pxe-image | 生成物理机安装所需的镜像及文件 |
-
-* OPTIONS
-
- | 参数 | 描述 |
- | ------------ | ------------------------------------------------------------ |
- | -p | repo 文件的路径repo 文件中配置制作镜像所需要的 yum 源 |
- | -v | 制作出来的KubeOS镜像的版本 |
- | -b | os-agent二进制的路径 |
- | -e | KubeOS 镜像 root 用户密码,加密后的带盐值的密码,可以用 opensslkiwi 命令生成 |
- | -d | 生成或者使用的 docke r镜像 |
- | -l | 如果指定参数则镜像为legacy引导不指定默认是UEFI引导 |
- | -h --help | 查看帮助信息 |
-
-## 使用说明
-
-### 注意事项
-
-* kbimg.sh 执行需要 root 权限
-* 当前仅支持 x86和 AArch64 架构使用
-* 容器 OS 镜像制作工具的 rpm 包源为 openEuler 具体版本的 everything 仓库和 EPOL 仓库。制作镜像时提供的 repo 文件中yum 源建议同时配置 openEuler 具体版本的 everything 仓库和 EPOL 仓库
-
-### KubeOS OCI 镜像制作
-
-#### 注意事项
-
-* 制作的 OCI 镜像仅用于后续的虚拟机/物理机镜像制作或升级使用,不支持启动容器
-* 使用默认 rpmlist 进行容器OS镜像制作时所需磁盘空间至少为6G如自已定义 rpmlist 可能会超过6G
-
-#### 使用示例
-
-* 如需进行DNS配置请先在```scripts```目录下自定义```resolv.conf```文件
-
-```shell
- cd /opt/kubeOS/scripts
- touch resolv.conf
- vim resolv.conf
-```
-
-* 制作KubeOS容器镜像
-
-``` shell
-cd /opt/kubeOS/scripts
-bash kbimg.sh create upgrade-image -p xxx.repo -v v1 -b ../bin/os-agent -e '''$1$xyz$RdLyKTL32WEvK3lg8CXID0''' -d your_imageRepository/imageName:version
-```
-
-* 制作完成后查看制作出来的KubeOS容器镜像
-
-``` shell
-docker images
-```
-
-### KubeOS 虚拟机镜像制作
-
-#### 注意事项
-
-* 如使用 docker 镜像制作请先拉取相应镜像或者先制作docker镜像并保证 docker 镜像的安全性
-* 制作出来的容器 OS 虚拟机镜像目前只能用于 CPU 架构为 x86 和 AArch64 的虚拟机
-* 容器 OS 目前不支持 x86 架构的虚拟机使用 legacy 启动模式启动
-* 使用默认rpmlist进行容器OS镜像制作时所需磁盘空间至少为25G如自已定义rpmlist可能会超过25G
-
-#### 使用示例
-
-* 使用repo源制作
- * 如需进行DNS配置请先在```scripts```目录下自定义```resolv.conf```文件
-
- ```shell
- cd /opt/kubeOS/scripts
- touch resolv.conf
- vim resolv.conf
- ```
-
- * KubeOS虚拟机镜像制作
-
- ``` shell
- cd /opt/kubeOS/scripts
- bash kbimg.sh create vm-image -p xxx.repo -v v1 -b ../bin/os-agent -e '''$1$xyz$RdLyKTL32WEvK3lg8CXID0'''
- ```
-
-* 使用docker镜像制作
-
- ``` shell
- cd /opt/kubeOS/scripts
- bash kbimg.sh create vm-image -d your_imageRepository/imageName:version
- ```
-
-* 结果说明
- 容器 OS 镜像制作完成后,会在 /opt/kubeOS/scripts 目录下生成:
- * system.qcow2: qcow2 格式的系统镜像,大小默认为 20GiB支持的根文件系统分区大小 < 2020 MiB持久化分区 < 16GiB 。
- * update.img: 用于升级的根文件系统分区镜像
-
-### KubeOS 物理机安装所需镜像及文件制作
-
-#### 注意事项
-
-* 如使用 docker 镜像制作请先拉取相应镜像或者先制作 docker 镜像,并保证 docker 镜像的安全性
-* 制作出来的容器 OS 物理安装所需的镜像目前只能用于 CPU 架构为 x86 和 AArch64 的物理机安装
-* Global.cfg配置中指定的ip为安装时使用的临时ip,请在系统安装启动后请参考《openEuler 22.09 管理员指南-配置网络》进行网络配置
-* 不支持多个磁盘都安装KubeOS可能会造成启动失败或挂载紊乱
-* 容器OS 目前不支持 x86 架构的物理机使用 legacy 启动模式启动
-* 使用默认rpmlist进行镜像制作时所需磁盘空间至少为5G如自已定义 rpmlist 可能会超过5G
-
-#### 使用示例
-
-* 首先需要修改```00bootup/Global.cfg```的配置对相关参数进行配置参数均为必填ip目前仅支持ipv4配置示例如下
-
- ```shell
- # rootfs file name
- rootfs_name=kubeos.tar
- # select the target disk to install kubeOS
- disk=/dev/sda
- # pxe server ip address where stores the rootfs on the http server
- server_ip=192.168.1.50
- # target machine temporary ip
- local_ip=192.168.1.100
- # target machine temporary route
- route_ip=192.168.1.1
- # target machine temporary netmask
- netmask=255.255.255.0
- # target machine netDevice name
- net_name=eth0
- ```
-
-* 使用 repo 源制作
- * 如需进行DNS配置请在```scripts```目录下自定义```resolv.conf```文件
-
- ```shell
- cd /opt/kubeOS/scripts
- touch resolv.conf
- vim resolv.conf
- ```
-
- * KubeOS物理机安装所需镜像制作
-
- ```shell
- cd /opt/kubeOS/scripts
- bash kbimg.sh create pxe-image -p xxx.repo -v v1 -b ../bin/os-agent -e '''$1$xyz$RdLyKTL32WEvK3lg8CXID0'''
- ```
-
-* 使用 docker 镜像制作
-
- ``` shell
- cd /opt/kubeOS/scripts
- bash kbimg.sh create pxe-image -d your_imageRepository/imageName:version
- ```
-
-* 结果说明
- * initramfs.img: 用于pxe启动用的 initramfs 镜像
- * kubeos.tar: pxe安装所用的 OS
-
-
-# KubeOS-Rust 镜像制作说明
-
-## 简介
-
-KubeOS 虚拟机镜像制作的 Rust 二进制版本
-
-## 命令介绍
-
-### 命令格式
-
-**.../kbimg** \[ --config | -c \] \<path to kbimg.toml\>
-
-## 配置文件说明
-
-* from_repo: 从 repo 创建 OCI 镜像、虚拟机镜像或物理机镜像
-
- | 参数 | 描述 |
- | --- | --- |
- | agent_path | os-agent 二进制的路径 |
- | image_type | upgrade: 用于安装和升级的 OCI 镜像格式的 KubeOS 镜像; vm-repo: 用于部署和升级的虚拟机镜像; pxe-repo: 物理机安装所需的镜像及文件 |
- | legacy_bios | 镜像为 legacy 引导或 UEFI 引导 |
- | repo_path | repo 文件的路径repo 文件中配置制作镜像所需要的 yum 源 |
- | root_passwd | KubeOS 镜像 root 用户密码,加密后的带盐值的密码,可以用 openssl、kiwi 命令生成 |
- | version | 制作出来的 KubeOS 镜像的版本 |
- | rpmlist | 镜像所需的 rpm 包 |
- | docker_img | 生成或者使用的 docker 镜像 |
-
-* from_docker: 从 docker 镜像创建虚拟机镜像或物理机镜像
-
- | 参数 | 描述 |
- | --- | --- |
- | docker_img | 生成或者使用的 docker 镜像 |
- | image_type | vm-docker: 用于部署和升级的虚拟机镜像; pxe-docker: 物理机安装所需的镜像及文件 |
-
-* admin_container:
-
- | 参数 | 描述 |
- | --- | --- |
- | dockerfile | dockerfile 路径 |
- | docker_img | 生成或者使用的 docker 镜像 |
-
-* [OPTIONAL] users: 添加用户
-
- | 参数 | 描述 |
- | --- | --- |
- | groups | [OPTIONAL] 用户组 (第一个为主组,其他为附加组) |
- | name | 用户名 |
- | passwd | 密码 |
- | sudo | [OPTIONAL] 用户是否具有 sudo 权限 |
-
-* [OPTIONAL] copy_files: 拷贝文件到指定目录
-
- | 参数 | 描述 |
- | --- | --- |
- | dst | 目标目录 |
- | src | 源文件路径 |
-
-* [OPTIONAL] grub: grub配置
-
- | 参数 | 描述 |
- | --- | --- |
- | passwd | [OPTIONAL] grub 密码 |
-
-* [OPTIONAL] systemd_service: 新增 systemd 服务
-
- | 参数 | 描述 |
- | --- | --- |
- | name | systemd 服务名 |
-
-* [OPTIONAL] chroot_script: 自定义 chroot 脚本
-
- | 参数 | 描述 |
- | --- | --- |
- | path | 脚本路径 |
-
-* [OPTIONAL] disk_partition: 自定义分区大小和镜像大小
-
- | 参数 | 描述 |
- | --- | --- |
- | first | 引导分区大小 |
- | second | ROOT-A 分区大小 |
- | third | ROOT-B 分区大小 |
- | img_size | 镜像大小 |
-
-* [OPTIONAL] persist_mkdir: persist 分区新建目录
-
- | 参数 | 描述 |
- | --- | --- |
- | name | 目录名 |
-
-## 使用说明
-
-#### 注意事项
-
-* 新增 systemd 服务需要将对应的 .service 文件或 .mount 文件拷贝至镜像```/usr/lib/systemd/system```目录
-
- ```toml
- [[copy_files]]
- dst = "/usr/lib/systemd/system"
- src = ".../containerd.service"
-
- [systemd_service]
- name = ["containerd"]
- ```
-
- * 如需挂载数据盘,请先自定义```persist-data.mount```文件,并启用```copy_files```和```systemd_service```字段设置启动时挂载,启用```persist_mkdir```字段创建挂载点
- * .mount文件名由挂载点路径生成将斜杠替换为连字符
- * 请先在磁盘映像文件上创建ext4文件系统
-
- ```
- # persist-data.mount
- [Unit]
- Description=Mount Disk
- Documentation=man:systemd.mount(5)
-
- [Mount]
- What=/dev/vdb
- Where=/persist/data
- Type=ext4
- Options=defaults,noatime
-
- [Install]
- WantedBy=local-fs.target
- ```
-
- ```toml
- [[copy_files]]
- dst = "/usr/lib/systemd/system"
- src = ".../persist-data.mount"
-
- [systemd_service]
- name = ["persist-data.mount"]
-
- [persist_mkdir]
- name = ["data"]
- ```
-
- * 如需配置逻辑卷,请先自定义```volume.service```文件,并启用```copy_files```和```systemd_service```设置启动时配置逻辑卷,启用```persist_mkdir```字段创建挂载点
-
- ```
- # volume.service
- [Unit]
- Description=Mount Logical Volume
- After=local-fs.target
-
- [Service]
- Type=oneshot
- RemainAfterExit=yes
- ExecStart=pvcreate /dev/vdb
- ExecStart=pvcreate /dev/vdc
- ExecStart=vgcreate my_vg /dev/vdb /dev/vdc
- ExecStart=lvcreate -L 15G -n my_lv my_vg
- ExecStart=mkfs.ext4 /dev/my_vg/my_lv
- ExecStart=mount /dev/my_vg/my_lv /persist/lv_data
-
- [Install]
- WantedBy=local-fs.target
- ```
-
- ```toml
- [[copy_files]]
- dst = "/usr/lib/systemd/system"
- src = ".../volume.service"
-
- [systemd_service]
- name = ["volume"]
-
- [persist_mkdir]
- name = ["lv_data"]
- ```
-
-## 使用示例
-
-### KubeOS OCI 镜像制作
-
-* 如需进行DNS配置请先自定义```resolv.conf```文件,并启用```copy_files```字段将配置文件拷贝到```/etc```目录
-
- ```shell
- touch \<arbitrary directory\>/resolv.conf
- vim \<arbitrary directory\>resolv.conf
- ```
-
- ```toml
- [[copy_files]]
- dst = "/etc"
- src = "<path to resolv.conf>"
- ```
-
-* 制作KubeOS容器镜像
-
- ```toml
- [from_repo]
- agent_path = "<directory>/bin/os-agent"
- image_type = "upgrade"
- legacy_bios = false
- repo_path = "xxx.repo"
- root_passwd = "$1$xyz$RdLyKTL32WEvK3lg8CXID0"
- version = "v1"
- docker_img = "your_imageRepository/imageName:version"
- rpmlist = [
- # your rpms
- ]
- ```
-
-* 制作完成后查看制作出来的KubeOS容器镜像
- ``` shell
- docker images
- ```
-
-### KubeOS 虚拟机镜像制作
-
-* 使用repo源制作
-
- * 如需进行DNS配置请先自定义```resolv.conf```文件,并启用**copy_files**字段将配置文件拷贝到```/etc```目录
-
- ```shell
- touch \<arbitrary directory\>/resolv.conf
- vim \<arbitrary directory\>resolv.conf
- ```
-
- ```toml
- [[copy_files]]
- dst = "/etc"
- src = "<path to resolv.conf>"
- ```
-
- * KubeOS虚拟机镜像制作
-
- ```toml
- [from_repo]
- agent_path = "<directory>/bin/os-agent"
- image_type = "vm-repo"
- legacy_bios = false
- repo_path = "xxx.repo"
- root_passwd = "$1$xyz$RdLyKTL32WEvK3lg8CXID0"
- version = "v1"
- rpmlist = [
- # your rpms
- ]
- ```
-
-* 使用docker镜像制作
-
- ```toml
- [from_dockerimg]
- docker_img = "your_imageRepository/imageName:version"
- image_type = "vm-docker"
- ```
-
-* 结果说明
- 容器 OS 镜像制作完成后,会在 ./scripts-auto 目录下生成
- * system.qcow2: qcow2 格式的系统镜像,大小默认为 20GiB支持的根文件系统分区大小 < 2020 MiB持久化分区 < 16GiB 。
- * update.img: 用于升级的根文件系统分区镜像
-
-### KubeOS 物理机安装所需镜像及文件制作
-
-* 首先需要修改```kbimg.toml```中```pxe_config```的配置对相关参数进行配置参数均为必填ip目前仅支持ipv4配置示例如下
-
- ```toml
- [pxe_config]
- # rootfs file name
- rootfs_name = "kubeos.tar"
- # select the target disk to install kubeOS
- disk = "/dev/sda"
- # pxe server ip address where stores the rootfs on the http server
- server_ip = "192.168.1.50"
- # target machine ip
- local_ip = "192.168.1.100"
- # target machine route
- route_ip = "192.168.1.1"
- # target machine netmask
- netmask = "255.255.255.0"
- # target machine netDevice name
- net_name = "eth0"
- ```
-
-* 使用 repo 源制作
- * 如需进行DNS配置请先自定义```resolv.conf```文件,并启用```copy_files```字段将配置文件拷贝到```/etc```目录
-
- ```shell
- touch \<arbitrary directory\>/resolv.conf
- vim \<arbitrary directory\>resolv.conf
- ```
-
- ```toml
- [[copy_files]]
- dst = "/etc"
- src = "<path to resolv.conf>"
- ```
-
- * KubeOS物理机安装所需镜像制作
- ```toml
- [from_repo]
- agent_path = "<directory>/bin/os-agent"
- image_type = "pxe-repo"
- legacy_bios = true
- repo_path = "xxx.repo"
- root_passwd = "$1$xyz$RdLyKTL32WEvK3lg8CXID0"
- version = "v1"
- rpmlist = [
- # your rpms
- ]
- ```
-
-* 使用 docker 镜像制作
- ```toml
- [from_dockerimg]
- docker_img = "your_imageRepository/imageName:version"
- image_type = "vm-docker"
- ```
-
-* 结果说明
- * initramfs.img: 用于pxe启动用的 initramfs 镜像
- * kubeos.tar: pxe安装所用的 OS
--
2.39.5 (Apple Git-154)