From 1559b84824331e4c7978b0777d274119cacd82d7 Mon Sep 17 00:00:00 2001 From: Yuhang Wei Date: Mon, 12 Aug 2024 19:42:24 +0800 Subject: [PATCH] docs: update readme and format yaml add kbimg command line explanation and the way to generate root passwd for login KubeOS format yamls Signed-off-by: Yuhang Wei --- .../admin-container/admin-container.yaml | 126 +++++++++--------- docs/example/config/manager/manager.yaml | 58 ++++---- .../config/samples/upgrade_v1alpha1_os.yaml | 68 +++++----- docs/quick-start.md | 122 ++++++++++------- ...66\344\275\234\346\214\207\345\257\274.md" | 71 +++++----- 5 files changed, 238 insertions(+), 207 deletions(-) diff --git a/docs/example/config/admin-container/admin-container.yaml b/docs/example/config/admin-container/admin-container.yaml index b5ec9e03..518b955f 100644 --- a/docs/example/config/admin-container/admin-container.yaml +++ b/docs/example/config/admin-container/admin-container.yaml @@ -1,63 +1,63 @@ -apiVersion: v1 -kind: Secret -metadata: - name: root-secret -data: - ssh-pub-key: your-ssh-pub-key ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: admin-container-sysmaster - namespace: default - labels: - control-plane: admin-container-sysmaster -spec: - selector: - matchLabels: - control-plane: admin-container-sysmaster - replicas: 1 - template: - metadata: - labels: - control-plane: admin-container-sysmaster - spec: - hostPID: true - containers: - - name: admin-container-sysmaster - image: your_imageRepository/admin_imageName:version - imagePullPolicy: Always - securityContext: - privileged: true - ports: - - containerPort: 22 - # sysmaster要求 - env: - - name: container - value: containerd - volumeMounts: - # name 必须与下面的卷名匹配 - - name: secret-volume - # mountPath必须为/etc/secret-volume - mountPath: /etc/secret-volume - readOnly: true - nodeName: your-worker-node-name - volumes: - - name: secret-volume - secret: - # secretName必须与上面指定的Secret的name相同 - secretName: root-secret ---- -apiVersion: v1 -kind: Service -metadata: - name: admin-container-sysmaster - namespace: default -spec: - type: NodePort - ports: - - port: 22 - targetPort: 22 - nodePort: your-exposed-port - selector: - control-plane: admin-container-sysmaster \ No newline at end of file +apiVersion: v1 +kind: Secret +metadata: + name: root-secret +data: + ssh-pub-key: +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: admin-container-sysmaster + namespace: default + labels: + control-plane: admin-container-sysmaster +spec: + selector: + matchLabels: + control-plane: admin-container-sysmaster + replicas: 1 + template: + metadata: + labels: + control-plane: admin-container-sysmaster + spec: + hostPID: true + containers: + - name: admin-container-sysmaster + image: + imagePullPolicy: Always + securityContext: + privileged: true + ports: + - containerPort: 22 + # sysmaster要求 + env: + - name: container + value: containerd + volumeMounts: + # name 必须与下面的卷名匹配 + - name: secret-volume + # mountPath必须为/etc/secret-volume + mountPath: /etc/secret-volume + readOnly: true + nodeName: + volumes: + - name: secret-volume + secret: + # secretName必须与上面指定的Secret的name相同 + secretName: root-secret +--- +apiVersion: v1 +kind: Service +metadata: + name: admin-container-sysmaster + namespace: default +spec: + type: NodePort + ports: + - port: 22 + targetPort: 22 + nodePort: + selector: + control-plane: admin-container-sysmaster diff --git a/docs/example/config/manager/manager.yaml b/docs/example/config/manager/manager.yaml index 93d15220..f5cf84f9 100644 --- a/docs/example/config/manager/manager.yaml +++ b/docs/example/config/manager/manager.yaml @@ -20,19 +20,19 @@ spec: control-plane: upgrade-proxy spec: containers: - - name: proxy - command: - - /proxy - image: edit.proxy.image.addr - volumeMounts: - - name: upgrade-agent - mountPath: /var/run/os-agent - env: - - name: NODE_NAME - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: spec.nodeName + - name: proxy + command: + - /proxy + image: + volumeMounts: + - name: upgrade-agent + mountPath: /var/run/os-agent + env: + - name: NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName volumes: - name: upgrade-agent hostPath: @@ -56,24 +56,26 @@ spec: control-plane: upgrade-operator spec: containers: - - command: - - /operator - image: edit.operator.image.addr - name: operator - securityContext: - allowPrivilegeEscalation: false - runAsUser: 6552 - runAsGroup: 6552 - resources: - limits: - cpu: 100m - memory: 30Mi - requests: - cpu: 100m - memory: 20Mi + - command: + - /operator + image: + name: operator + securityContext: + allowPrivilegeEscalation: false + runAsUser: 6552 + runAsGroup: 6552 + resources: + limits: + cpu: 100m + memory: 30Mi + requests: + cpu: 100m + memory: 20Mi terminationGracePeriodSeconds: 10 nodeSelector: node-role.kubernetes.io/control-plane: "" tolerations: - key: "node-role.kubernetes.io/master" operator: "Exists" + - key: "node-role.kubernetes.io/control-plane" + operator: "Exists" diff --git a/docs/example/config/samples/upgrade_v1alpha1_os.yaml b/docs/example/config/samples/upgrade_v1alpha1_os.yaml index b33a30b2..d7528831 100644 --- a/docs/example/config/samples/upgrade_v1alpha1_os.yaml +++ b/docs/example/config/samples/upgrade_v1alpha1_os.yaml @@ -1,38 +1,38 @@ apiVersion: upgrade.openeuler.org/v1alpha1 kind: OS metadata: - name: os-sample + name: os-sample spec: - imagetype: docker/containerd/disk - opstype: upgrade/config/rollback - osversion: edit.os.version - maxunavailable: edit.node.upgrade.number - containerimage: "" - evictpodforce: true - imageurl: "" - checksum: image digests - flagSafe: false - mtls: false - sysconfigs: - version: edit.sysconfig.version - configs: - - model: kernel.systcl - contents: - - key: kernel param key1 - value: kernel param value1 - - key: kernel param key2 - value: kernel param value2 - - model: kernel.systcl.persist - configpath: persist file path - contents: - - key: kernel param key3 - value: kernel param value3 - operation: delete - upgradeconfigs: - version: edit.upgradeconfig.version - configs: - - model: kernel.systcl - contents: - - key: kernel param key4 - value: kernel param value4 - operation: delete \ No newline at end of file + imagetype: docker/containerd/disk + opstype: upgrade/config/rollback + osversion: edit.os.version + maxunavailable: edit.node.upgrade.number + containerimage: "" + evictpodforce: true + imageurl: "" + checksum: image digests + flagSafe: false + mtls: false + sysconfigs: + version: edit.sysconfig.version + configs: + - model: kernel.sysctl + contents: + - key: kernel param key1 + value: kernel param value1 + - key: kernel param key2 + value: kernel param value2 + - model: kernel.sysctl.persist + configpath: persist file path + contents: + - key: kernel param key3 + value: kernel param value3 + operation: delete + upgradeconfigs: + version: edit.upgradeconfig.version + configs: + - model: kernel.sysctl + contents: + - key: kernel param key4 + value: kernel param value4 + operation: delete diff --git a/docs/quick-start.md b/docs/quick-start.md index 9656fb99..372c904b 100644 --- a/docs/quick-start.md +++ b/docs/quick-start.md @@ -10,8 +10,8 @@ * golang(大于等于1.15版本) * make * git - * rust(大于等于1.57版本) - * cargo(大于等于1.57版本) + * rust(大于等于1.64版本) + * cargo(大于等于1.64版本) * openssl-devel ``` shell @@ -65,11 +65,18 @@ * Dockerfile参考如下, Dockerfile也可以使用多阶段构建: + `proxy`容器镜像Dockerfile + ``` dockerfile - FROM your_baseimage + FROM openeuler/openeuler:24.03-lts COPY ./bin/proxy /proxy ENTRYPOINT ["/proxy"] - FROM your_baseimage + ``` + + `operator`容器镜像Dockerfile + + ``` dockerfile + FROM openeuler/openeuler:24.03-lts COPY --chown=6552:6552 ./bin/operator /operator ENTRYPOINT ["/operator"] ``` @@ -112,14 +119,34 @@ bash kbimg.sh create vm-image -p xxx.repo -v v1 -b ../bin/os-agent -e '''$1$xyz$RdLyKTL32WEvK3lg8CXID0''' ``` - * 其中 xx.repo 为制作镜像所需要的 yum 源,yum 源建议配置为 openEuler 具体版本的 everything 仓库和 EPOL 仓库。 - * 容器 OS 镜像制作完成后,会在 scripts 目录下生成: - * raw格式的系统镜像system.img,system.img大小默认为20G,支持的根文件系统分区大小<2020MiB,持久化分区<16GB。 - * qcow2 格式的系统镜像 system.qcow2。 - * 可用于升级的根文件系统分区镜像 update.img 。 - * 制作出来的容器 OS 虚拟机镜像目前只能用于 CPU 架构为 x86 和 AArch64 的虚拟机场景,x86 架构的虚拟机使用 legacy 启动模式启动需制作镜像时指定-l参数 - * 容器OS运行底噪<150M (不包含k8s组件及相关依赖kubernetes-kubeadm,kubernetes-kubelet, containernetworking-plugins,socat,conntrack-tools,ebtables,ethtool) - * 本项目不提供容器OS镜像,仅提供裁剪工具,裁剪出来的容器OS内部的安全性由OS发行商保证。 + 参数说明如下: + + ```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.img,system.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-kubeadm,kubernetes-kubelet, containernetworking-plugins,socat,conntrack-tools,ebtables,ethtool) + * 本项目不提供容器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框架,必须使用端口。他们部署在容器里。 @@ -173,7 +200,7 @@ ## 使用指导 -#### 注意事项 +### 注意事项 * 公共注意事项 * 仅支持虚拟机x86和arm64 UEFI场景。 @@ -209,7 +236,7 @@ | 参数 |参数类型 | 参数说明 | 使用说明 | 是否必选 | | -------------- | ------ | ------------------------------------------------------------ | ----- | ---------------- | - | imagetype | string | 升级镜像的类型 | 仅支持docker ,containerd ,或者是 disk,仅在升级场景有效。
**注意**:若使用containerd,agent优先使用crictl工具拉取镜像,没有crictl时才会使用ctr命令拉取镜像。使用ctr拉取镜像时,镜像如果在私有仓内,需按照[官方文档](https://github.com/containerd/containerd/blob/main/docs/hosts.md)在/etc/containerd/certs.d目录下配置私有仓主机信息,才能成功拉取镜像。 |是 | + | imagetype | string | 升级镜像的类型 | 仅支持docker ,containerd ,或者是 disk,仅在升级场景有效。**注意**:若使用containerd,agent优先使用crictl工具拉取镜像,没有crictl时才会使用ctr命令拉取镜像。使用ctr拉取镜像时,镜像如果在私有仓内,需按照[官方文档](https://github.com/containerd/containerd/blob/main/docs/hosts.md)在/etc/containerd/certs.d目录下配置私有仓主机信息,才能成功拉取镜像。 |是 | | opstype | string | 操作类型:升级,回退或者配置 | 仅支持upgrade ,config 或者 rollback |是 | | osversion | string | 升级/回退的目标版本 | osversion需与节点的目标os版本对应(节点上/etc/os-release中PRETTY_NAME字段或k8s检查到的节点os版本) 例如:KubeOS 1.0.0。 |是 | | maxunavailable | int | 每批同时进行升级/回退/配置的节点数。 | maxunavailable值大于实际节点数时,取实际节点数进行升级/回退/配置。 |是 | @@ -357,13 +384,13 @@ kubectl get nodes -o custom-columns='NAME:.metadata.name,OS:.status.nodeInfo.osImage' ``` -* 如果后续需要再次升级,与上面相同,对upgrade_v1alpha1_os.yaml的相应字段进行修改 +* 如果后续需要再次升级,与上面相同,对upgrade_v1alpha1_os.yaml的相应字段进行修改 #### 配置(Settings)指导 * Settings参数说明: - 基于示例YAML对配置的参数进行说明,示例YAML如下,配置的格式(缩进)需和示例保持一致: + 基于示例YAML对配置的参数进行说明,示例YAML如下,配置的格式(缩进)需和示例保持一致: ```yaml apiVersion: upgrade.openeuler.org/v1alpha1 @@ -424,9 +451,7 @@ | value | string | 参数值 | key=value形式的参数中,value不能为空,不建议配置含空格、tab键的字符串,具体请看附录下的```Settings列表```中对每种配置类型对value的说明。 | key=value形式的参数必选 | | operation | string | 对参数进行的操作 | 仅对kernel.sysctl.persist、grub.cmdline.current、grub.cmdline.next类型的参数生效。默认为添加或更新。仅支持配置为delete,代表删除已存在的参数(key=value需完全一致才能删除)。 | 否 | - - - * upgradeconfigs与sysconfigs参数相同,upgradeconfigs为升级/回退前进行的配置,仅在upgrade/rollback场景起效,sysconfigs既支持只进行配置,也支持在升级/回退重启后进行配置 + * upgradeconfigs与sysconfigs参数相同,upgradeconfigs为升级/回退前进行的配置,仅在upgrade/rollback场景起效,sysconfigs既支持只进行配置,也支持在升级/回退重启后进行配置 * 使用说明 @@ -463,7 +488,7 @@ 2. upgrade模式重新升级至上一版本 * 手动回退指导 - * 手动重启虚拟机,进入启动项页面后,选择第二启动项进行回退,手动回退仅支持回退到上一个版本。 + * 手动重启虚拟机,进入启动项页面后,选择第二启动项进行回退,手动回退仅支持回退到上一个版本。 * 工具回退指导 * 回退至任意版本 * 修改 OS 的cr实例的YAML 配置文件(例如 upgrade_v1alpha1_os.yaml),设置相应字段为期望回退的老版本镜像信息。类别OS来自于安装和部署章节创建的CRD对象,字段说明及示例请见上一节升级指导。 @@ -554,19 +579,14 @@ KubeOS提供一个分离的包含sshd服务和hostshell工具的Admin容器, ```Dockerfile FROM openeuler-22.03-lts-sp1 - RUN yum -y install openssh-clients util-linux - ADD ./your-sysmaster.rpm /home RUN rpm -ivh /home/your-sysmaster.rpm - COPY ./hostshell /usr/bin/ COPY ./set-ssh-pub-key.sh /usr/local/bin COPY ./set-ssh-pub-key.service /usr/lib/sysmaster - EXPOSE 22 RUN sed -i 's/sysinit.target/sysinit.target;sshd.service;set-ssh-pub-key.service/g' /usr/lib/sysmaster/basic.target - CMD ["/usr/lib/sysmaster/init"] ``` @@ -594,8 +614,7 @@ kind: Secret metadata: name: root-secret data: - # base64 encode your pub key in one line - ssh-pub-key: your-ssh-pub-key + ssh-pub-key: --- apiVersion: apps/v1 kind: Deployment @@ -603,7 +622,7 @@ metadata: name: admin-container-sysmaster namespace: default labels: - control-plane: admin-container-sysmaster + control-plane: admin-container-sysmaster spec: selector: matchLabels: @@ -616,24 +635,24 @@ spec: spec: hostPID: true containers: - - name: admin-container-sysmaster - image: your_imageRepository/admin_imageName:version - imagePullPolicy: Always - securityContext: - privileged: true - ports: - - containerPort: 22 - # sysmaster要求 - env: - - name: container - value: containerd - volumeMounts: - # name 必须与下面的卷名匹配 - - name: secret-volume - # mountPath必须为/etc/secret-volume - mountPath: /etc/secret-volume - readOnly: true - nodeName: your-worker-node-name + - name: admin-container-sysmaster + image: + imagePullPolicy: Always + securityContext: + privileged: true + ports: + - containerPort: 22 + # sysmaster要求 + env: + - name: container + value: containerd + volumeMounts: + # name 必须与下面的卷名匹配 + - name: secret-volume + # mountPath必须为/etc/secret-volume + mountPath: /etc/secret-volume + readOnly: true + nodeName: volumes: - name: secret-volume secret: @@ -650,9 +669,9 @@ spec: ports: - port: 22 targetPort: 22 - nodePort: your-exposed-port + nodePort: selector: - control-plane: admin-container-sysmaster + control-plane: admin-container-sysmaster ``` ### admin容器使用 @@ -680,6 +699,7 @@ hostshell #### kernel Settings * kenerl.sysctl:临时设置内核参数,重启后无效,key/value 表示内核参数的 key/value, key与value均不能为空且key不能包含“=”,该参数不支持删除操作(operation=delete)示例如下: + ```yaml configs: - model: kernel.sysctl @@ -690,7 +710,9 @@ hostshell value: 0 operation: delete ``` + * kenerl.sysctl:临时设置内核参数,重启后无效,key/value 表示内核参数的 key/value, key与value均不能为空且key不能包含“=”,该参数不支持删除操作(operation=delete)示例如下: + ```yaml configs: - model: kernel.sysctl.persist @@ -713,8 +735,8 @@ hostshell * KubeOS使用双分区,grub.cmdline支持对当前分区或下一分区进行配置: - - grub.cmdline.current:对当前分区的启动项参数进行配置。 - - grub.cmdline.next:对下一分区的启动项参数进行配置。 + * grub.cmdline.current:对当前分区的启动项参数进行配置。 + * grub.cmdline.next:对下一分区的启动项参数进行配置。 * 注意:升级/回退前后的配置,始终基于升级/回退操作下发时的分区位置进行current/next的区分。假设当前分区为A分区,下发升级操作并在sysconfigs(升级重启后配置)中配置grub.cmdline.current,重启后进行配置时仍修改A分区对应的grub cmdline。 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" index f2823c85..155bc96f 100644 --- "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" @@ -1,16 +1,16 @@ -# 容器OS镜像制作指导# +# 容器OS镜像制作指导 -## 简介 ## +## 简介 kbimg是KubeOS部署和升级所需的镜像制作工具,可以使用kbimg制作KubeOS 容器,虚拟机和物理机镜像 -## 命令介绍 ## +## 命令介绍 -### 命令格式 ### +### 命令格式 **bash kbimg.sh** \[ --help | -h \] create \[ COMMANDS \] \[ OPTIONS \] -### 参数说明 ### +### 参数说明 * COMMANDS @@ -20,8 +20,6 @@ kbimg是KubeOS部署和升级所需的镜像制作工具,可以使用kbimg制 | vm-image | 生成用于部署和升级的虚拟机镜像 | | pxe-image | 生成物理机安装所需的镜像及文件 | - - * OPTIONS | 参数 | 描述 | @@ -34,31 +32,33 @@ kbimg是KubeOS部署和升级所需的镜像制作工具,可以使用kbimg制 | -l | 如果指定参数,则镜像为legacy引导,不指定默认是UEFI引导 | | -h --help | 查看帮助信息 | +## 使用说明 - -## 使用说明 ## - -#### 注意事项 ### +### 注意事项 * kbimg.sh 执行需要 root 权限 * 当前仅支持 x86和 AArch64 架构使用 * 容器 OS 镜像制作工具的 rpm 包源为 openEuler 具体版本的 everything 仓库和 EPOL 仓库。制作镜像时提供的 repo 文件中,yum 源建议同时配置 openEuler 具体版本的 everything 仓库和 EPOL 仓库 -### KubeOS OCI 镜像制作 ### +### 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 @@ -70,25 +70,28 @@ bash kbimg.sh create upgrade-image -p xxx.repo -v v1 -b ../bin/os-agent -e '''$1 docker images ``` -### KubeOS 虚拟机镜像制作 ### +### KubeOS 虚拟机镜像制作 -#### 注意事项 #### +#### 注意事项 * 如使用 docker 镜像制作请先拉取相应镜像或者先制作docker镜像,并保证 docker 镜像的安全性 * 制作出来的容器 OS 虚拟机镜像目前只能用于 CPU 架构为 x86 和 AArch64 的虚拟机 * 容器 OS 目前不支持 x86 架构的虚拟机使用 legacy 启动模式启动 * 使用默认rpmlist进行容器OS镜像制作时所需磁盘空间至少为25G,如自已定义rpmlist可能会超过25G -#### 使用示例 #### +#### 使用示例 * 使用repo源制作 - * 如需进行DNS配置,请先在```scripts```目录下自定义```resolv.conf```文件 + * 如需进行DNS配置,请先在```scripts```目录下自定义```resolv.conf```文件 + ```shell cd /opt/kubeOS/scripts touch resolv.conf vim resolv.conf ``` - * KubeOS虚拟机镜像制作 + + * 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''' @@ -100,15 +103,15 @@ docker images 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: 用于升级的根文件系统分区镜像 +* 结果说明 + 容器 OS 镜像制作完成后,会在 /opt/kubeOS/scripts 目录下生成: + * system.qcow2: qcow2 格式的系统镜像,大小默认为 20GiB,支持的根文件系统分区大小 < 2020 MiB,持久化分区 < 16GiB 。 + * update.img: 用于升级的根文件系统分区镜像 -### KubeOS 物理机安装所需镜像及文件制作 ### +### KubeOS 物理机安装所需镜像及文件制作 -#### 注意事项 #### +#### 注意事项 * 如使用 docker 镜像制作请先拉取相应镜像或者先制作 docker 镜像,并保证 docker 镜像的安全性 * 制作出来的容器 OS 物理安装所需的镜像目前只能用于 CPU 架构为 x86 和 AArch64 的物理机安装 @@ -116,7 +119,8 @@ docker images * 不支持多个磁盘都安装KubeOS,可能会造成启动失败或挂载紊乱 * 容器OS 目前不支持 x86 架构的物理机使用 legacy 启动模式启动 * 使用默认rpmlist进行镜像制作时所需磁盘空间至少为5G,如自已定义 rpmlist 可能会超过5G -#### 使用示例 #### + +#### 使用示例 * 首先需要修改```00bootup/Global.cfg```的配置,对相关参数进行配置,参数均为必填,ip目前仅支持ipv4,配置示例如下 @@ -138,25 +142,28 @@ docker images ``` * 使用 repo 源制作 - * 如需进行DNS配置,请在```scripts```目录下自定义```resolv.conf```文件 + * 如需进行DNS配置,请在```scripts```目录下自定义```resolv.conf```文件 + ```shell cd /opt/kubeOS/scripts touch resolv.conf vim resolv.conf ``` - * KubeOS物理机安装所需镜像制作 - ``` + + * 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 + * initramfs.img: 用于pxe启动用的 initramfs 镜像 + * kubeos.tar: pxe安装所用的 OS -- Gitee