Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zexi committed Nov 24, 2023
0 parents commit 71856eb
Show file tree
Hide file tree
Showing 132 changed files with 14,957 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Hugo default output directory
/public
/resources/_gen/

## OS Files
# Windows
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/

# OSX
.DS_Store

# npm
node_modules
package-lock.json

# container run
.ash_history

# web storm
.idea/

*.o
*.a
*.so
*.swp

# hugo
.hugo_build.lock
.content
.assets
.static

# convert results
_output

# python
*.pyc
__pycache__
data/

docs-old

# docusaurus
.docusaurus/
build/
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ref: https://github.com/m3ng9i/ran
FROM registry.cn-beijing.aliyuncs.com/yunionio/ran:v0.1

COPY ./build /web
WORKDIR /web
ENTRYPOINT ["/ran", "-port=8081"]

23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.PHONY: build

# check: https://docusaurus.io/docs/i18n/tutorial
write-en-translation:
yarn write-translations --locale en

serve:
npm run start

serve-en:
npm run start -- --locale en

build:
yarn build

build-serve: build
cd ./build/ && python3 -m http.server 8002

sync-translation-files:
rsync -avP ./docs/* ./i18n/en/docusaurus-plugin-content-docs/current/

image:
docker buildx build --platform linux/amd64,linux/arm64 --push -t zexi/cloudpods-docs:v1 -f ./Dockerfile .
9 changes: 9 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See the OWNERS docs at https://go.k8s.io/owners
reviewers:
- swordqiu
- Zexi
- ioito
- tb365
approvers:
- swordqiu
- Zexi
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
34 changes: 34 additions & 0 deletions docs/getting-started/_parts/_ha-env.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import OcbootEnv from '../_parts/_quickstart-ocboot-env.mdx';

<OcbootEnv />

假设准备好了 3 台 CentOS7 机器,以及 1 台 Mariadb/MySQL 的机器,规划如下:

| role | ip | interface | note |
| ------------ | ------------- | --------- | ----------------------------------------------------------- |
| k8s primary | 10.127.90.101 | eth0 | 第1个控制节点 |
| k8s master 1 | 10.127.90.102 | eth0 | 第2个控制节点 |
| k8s master 2 | 10.127.90.103 | eth0 | 第3个控制节点 |
| k8s VIP | 10.127.190.10 | - | keepalived 使用的 vip ,会优先绑定在 3 个控制节点中的第一个 |
| DB | 10.127.190.11 | - | 数据库独立节点 pswd="0neC1oudDB#", port=3306 |

其中 DB 的部署目前是不归 ocboot 部署工具管理的,需要提前手动部署。 建议使用 MariaDB 数据库,不要使用 MySQL 5.6及以下版本,防止出现索引长度 bug: Index column size too large. The maximum column size is 767 bytes. 的问题。各发行版对应 MariaDB 版本如下:

- Centos 7.6-7.9 Minimal(X86_64和ARM64) 默认安装MariaDB 5.5.68
- Debian 10-11(X86_64和ARM64) 默认安装MariaDB 10.3.1
- Kylin V10 sp2(X86_64和ARM64) 默认安装MariaDB 10.3.4

另外高可用的数据库部署也可以参考文档:[部署 Mariadb HA 环境](../misc/db-ha)

## 高可用集群 ntp 一致性

请在安装之前,确保各个待部署节点的时间一致,否则会出现在签发证书步骤失败。

如果是联网安装,可以参考下面的命令,确保集群内每台服务器都与互联网时间保持一致:

```bash
# 您可以选择更方便、可达的授时服务器
# 如果提示没有ntpdate 命令,请使用 os 对应的包管理器自行安装
# 例如在centos 上: yum install -y ntp && systemctl enable ntpd --now
$ ntpdate -u edu.ntp.org.cn && hwclock -w && ntpdate -u -q edu.ntp.org.cn
```
39 changes: 39 additions & 0 deletions docs/getting-started/_parts/_ha-faq-readd.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
3个控制节点都会运行 kube-apiserver, etcd 这些关键服务,如果遇到某一个节点遇到 etcd 数据不一致,可以将该节点 reset 后重新加入集群,步骤如下:

```bash
# 到其他正常的控制节点创建 join token
$ export KUBECONFIG=/etc/kubernetes/admin.conf
$ ocadm token create --description "ocadm-playbook-node-joining-token" --ttl 90m
2fmpbx.7zikd8sp5uhaxrjr

# 获取控制节点认证
$ /opt/yunion/bin/ocadm init phase upload-certs | grep -v upload-certs
6150f8da2dcdf3a8a730f407ddce9f1cb9f24b15ffa4e4b3680e16ed40201cf0

########## 注意下面的命令需要登陆到需要重新加入的节点执行 ###########
# 如果该节点曾经作为计算节点加入过云平台
# 需要备份当前宿主机 /etc/yunion/host.conf 配置
[your-reset-node] $ cp /etc/yunion/host.conf /etc/yunion/host.conf.manual.bk

# 登陆到需要重新 reset 加入的节点,reset 当前的 kubernetes 环境
[your-reset-node] $ kubeadm reset -f

# 假设当前的网卡为 bond0(如果不做 bond ,物理网卡一般为 eth0 之类的名称),ip 为 172.16.84.40,需要加入集群 172.16.84.101:6443 集群
[your-reset-node] $ ocadm join \
--control-plane 172.16.84.101:6443 \ # 加入的目标集群
--token 2fmpbx.7zikd8sp5uhaxrjr --certificate-key 6150f8da2dcdf3a8a730f407ddce9f1cb9f24b15ffa4e4b3680e16ed40201cf0 --discovery-token-unsafe-skip-ca-verification \ # 加入认证信息
--apiserver-advertise-address 172.16.84.40 --node-ip 172.16.84.40 \ # 该节点 ip
--as-onecloud-controller \ # 作为 cloudpods 控制节点
--enable-host-agent \ # 作为 cloudpods 计算节点
--host-networks 'bond0/br0/172.16.84.40' \ # 计算节点的桥接网络,意思创建 br0 网桥,并把 bond0 加入进来,给 br0 网桥配置 ip 172.16.84.40
--high-availability-vip 172.16.84.101 --keepalived-version-tag v2.0.25 # keepalived 的 vip ,保证 kube-apiserver 的高可用性

# 等待加入完成后,还原 /etc/yunion/host.conf.manual.bk 配置
[your-reset-node] $ cp /etc/yunion/host.conf.manual.bk /etc/yunion/host.conf

# 重启 host 服务
$ kubectl get pods -n onecloud -o wide | grep host | grep $your-reset-node
$ kubectl delete pods -n onecloud default-host-xxxx
```

以上手动的步骤参考了 ocboot join master-node 的逻辑,可参考 [https://github.com/yunionio/ocboot/blob/master/onecloud/roles/master-node/tasks/main.yml](https://github.com/yunionio/ocboot/blob/master/onecloud/roles/master-node/tasks/main.yml)
5 changes: 5 additions & 0 deletions docs/getting-started/_parts/_quickstart-faq-reset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
执行下面的步骤进行重装:

1. 执行 `kubeadm reset -f` 删除 kubernetes 集群

2. 重新运行 ocboot 的 run.py 脚本
20 changes: 20 additions & 0 deletions docs/getting-started/_parts/_quickstart-faq-virt-host.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
如下图所示,若发现环境部署完成后宿主机列表中没有宿主机,可按照以下方式进行排查

![](../images/nohost.png)


1. 在控制节点排查 host 问题,请参考:[Host服务问题排障技巧](../virt/faq/host)


1. 若日志报错信息中包含“register failed: try create network: find_matched == false”,则表示未成功创建包含宿主机的IP子网,导致宿主机注册失败,请创建包含宿主机网段的IP子网。

```
# 创建包含宿主机网段的IP子网
$ climc network-create bcast0 adm0 <start_ip> <end_ip> mask
```
![](../images/iperror.png)
2. 若日志报错信息中包含“name starts with letter, and contains letter, number and - only”,则表示宿主机的主机名不合规,应改成以字母开头的hostname
![](../images/hostnameerror.png)
18 changes: 18 additions & 0 deletions docs/getting-started/_parts/_quickstart-faq-virt-vm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
All in One 部署的节点会部署 Cloudpods host 计算服务,作为宿主机,具有创建和管理私有云虚拟机的能力。没有虚拟机界面应该是 Cloudpods 环境中没有启用宿主机。

请到 `管理后台` 界面,点击 `主机/基础资源/宿主机` 查看宿主机列表,启用相应的宿主机,刷新界面就会出现虚拟机界面。

:::note
如果要使用 Cloudpods 私有云虚拟机,并且宿主机是 CentOS 7 的发行版。需要宿主机使用 Cloudpods 编译的内核,可使用以下命令查看宿主机是否使用 Cloudpods 内核(包含 yn 关键字)。

```bash
# 查看是否使用 yn 内核
uname -a | grep yn
Linux office-controller 3.10.0-1160.6.1.el7.yn20201125.x86_64

# 如果内核不是带有 yn 关键字的版本,可能是第一次使用 ocboot 安装,重启即可进入 yn 内核
reboot
```
:::

![宿主机](../images/host.png)
59 changes: 59 additions & 0 deletions docs/getting-started/_parts/_quickstart-ocboot-ansible.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

首先需要安装ansible和git,ansible版本要求最低2.9.27,其中2.11.12测试较多。

<Tabs>
<TabItem value="CentOS 7" label="CentOS 7" default>

```bash
# 本地安装 ansible 和 git
$ yum install -y epel-release git python3-pip
$ python3 -m pip install --upgrade pip setuptools wheel
$ python3 -m pip install --upgrade ansible
```

</TabItem>

<TabItem value="Debian 10/11" label="Debian 10/11">

如果提示`locale`相关的报错,请先执行:

```bash
if ! grep -q '^en_US.UTF-8' /etc/locale.gen; then
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen
locale-gen
echo 'LANG="en_US.UTF-8"' >> /etc/default/locale
source /etc/default/locale
fi
```

```bash
# 本地安装 ansible 和 git
$ apt install -y git python3-pip
$ python3 -m pip install --upgrade pip setuptools wheel
$ python3 -m pip install --upgrade ansible
```
备注:已知在`debian 11`环境,如果`/proc/cmdline`里找不到启动选项 `systemd.unified_cgroup_hierarchy=0`,ocboot会自动配置相关的`GRUB`选项,重建启动参数,并重启操作系统,以便 `k8s` 能够正常启动。

</TabItem>

<TabItem value="Kylin V10" label="Kylin V10">
```bash
# 本地安装 ansible 和 git
$ yum install -y git python3-pip
$ python3 -m pip install --upgrade pip setuptools wheel
$ python3 -m pip install --upgrade ansible
```
</TabItem>

<TabItem value="其它操作系统" label="其它操作系统" >

```bash
# 本地安装 ansible
$ python3 -m pip install --upgrade pip setuptools wheel
$ python3 -m pip install --upgrade ansible
```
</TabItem>
</Tabs>

10 changes: 10 additions & 0 deletions docs/getting-started/_parts/_quickstart-ocboot-env.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- 操作系统: 根据 CPU 架构不同,支持的发行版也不一样,目前支持的发行版情况如下:
- [CentOS 7.6~7.9 Minimal](http://isoredirect.centos.org/centos/7/isos): 支持 x86_64 和 arm64
- [Debian 10/11](https://www.debian.org/distrib/): 支持 x86_64 和 arm64
- [Ubuntu 22.04](https://releases.ubuntu.com/jammy/): 仅支持 x86_64
- [银河麒麟V10 SP2/SP3](https://www.kylinos.cn/scheme/server/1.html): 支持 x86_64 和 arm64
- [统信 UOS kongzi](https://www.chinauos.com/): 支持 x86_64 和 arm64
- 操作系统需要是干净的版本,因为部署工具会重头搭建指定版本的 kubernetes 集群,所以确保系统没有安装 kubernetes, docker 等容器管理工具,否则会出现冲突导致安装异常
- 最低配置要求: CPU 4核, 内存 8GiB, 存储 100GiB
- 虚拟机和服务使用的存储路径都在 **/opt** 目录下,所以理想环境下建议单独给 **/opt** 目录设置挂载点
- 比如把 /dev/sdb1 单独分区做 ext4 然后通过 /etc/fstab 挂载到 /opt 目录
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import OcbootClone from '@site/src/components/OcbootClone';

部署的工具在 [https://github.com/yunionio/ocboot](https://github.com/yunionio/ocboot),需要把该工具使用 `git clone` 下来,然后运行 `run.py` 脚本部署服务。操作步骤如下:

<OcbootClone />

接下来执行 `run.py` 部署服务。其中 **host_ip** 为部署节点的 IP 地址,该参数为可选项。如果不指定则选择默认路由出去的那张网卡部署服务。如果你的节点有多张网卡,可以通过指定 **host_ip** 选择对应网卡监听服务。

import OcbootRun from '@site/src/components/OcbootRun';

<OcbootRun productVersion={props.productVersion} />

`./run.py` 脚本会调用 ansible 部署服务,如果部署过程中遇到问题导致脚本退出,可以重复执行该脚本进行重试。

:::tip 注意
如果是基于 CentOS 7 发行版部署,会因为安装内核导致一次重启。./run.py 脚本会中断,请等待操作系统重启后,重新执行一次 ./run.py 脚本,进行后续步骤的安装。
:::

## 部署完成

```bash
....
# 部署完成后会有如下输出,表示运行成功
# 浏览器打开 https://10.168.26.216 ,该 ip 为之前设置 <host_ip>
# 使用 admin/admin@123 用户密码登录就能访问前端界面
Initialized successfully!
Web page: https://10.168.26.216
User: admin
Password: admin@123
```

然后用浏览器访问 https://10.168.26.216 ,用户名输入 `admin`,密码输入 `admin@123` 就会进入 Cloudpods 的界面。

![登录页](../images/index.png)
7 changes: 7 additions & 0 deletions docs/getting-started/_parts/_quickstart-use-cmp.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Cloudpods 可以统一纳管其他云平台的资源。

`多云管理` 菜单,选择 `云账号` 并新建,根据自己的需求填写对应云平台的认证信息,配置完云账号后 Cloudpods 服务就会同步相应云平台的资源,同步完成后即可在前端查看。

![多云管理](../images/cloudaccount.png)


23 changes: 23 additions & 0 deletions docs/getting-started/_parts/_quickstart-use-virt.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

通过如下三步创建出第一台虚拟机:

#### 1. 导入镜像

浏览位于 [CentOS 7云主机镜像](https://cloud.centos.org/centos/7/images/) ,选择一个GenericCloud 镜像,拷贝镜像URL。

`主机` 菜单,选择 `系统镜像`,选择 `上传`。输入镜像名称,选择 `输入镜像URL`,粘贴上述CentOS 7镜像URL,选择 `确定`

可以访问 https://docs.openstack.org/image-guide/obtain-images.html 获得更多的虚拟机镜像。

#### 2. 创建网络(VPC和IP子网)

[新建VPC]`网络` 菜单,选择 `VPC` 子菜单,选择 `新建`。输入名称,例如 `vpc0`,选择目标网段,例如 `192.168.0.0/16`。点击 `新建`

[新建IP子网] VPC创建完成后,选择 `IP子网` 子菜单,选择 `新建`。输入名称,例如 `vnet0`,选择VPC为刚才创建的VPC `vpc0`,选择可用区,输入 `子网网段`,例如 `192.168.100.0/24`。点击 `新建`

[典型网络配置](../../guides/virt/network/examples)提供了几种常见的宿主机网络配置,请参考。

#### 3. 创建虚拟机

`主机` 菜单,选择 `虚拟机`,选择 `新建`。在此界面输入主机名,选择镜像和IP子网,创建虚拟机。

Loading

0 comments on commit 71856eb

Please sign in to comment.