74 lines
2.2 KiB
Markdown
74 lines
2.2 KiB
Markdown
> 本文作者:丁辉
|
||
|
||
# Kuboard管理Kubernetes
|
||
|
||
[Docker内安装文档]() [Kubernetes内安装文档](https://kuboard.cn/install/v3/install-in-k8s.html)
|
||
|
||
## 部署Kuboard
|
||
|
||
### Docker部署(推荐)
|
||
|
||
> 官方说法:在普通部署模式下 Kuboard 通常只部署了一个容器实例,存在单点故障,因此 Kuboard 本身并不能保证高可用。但是在 Kuboard 出现故障时,并不影响 Kubernetes 的正常,因此,普通部署模式下安装的 Kuboard 是可以满足绝大部分用户的需求的。普通部署模式下,当 Kuboard 出现故障时,可以重新部署一个 Kuboard,并导入 Kubernetes 到新的 Kuboard 实例,即可恢复故障。
|
||
|
||
```bash
|
||
sudo docker run -d \
|
||
--restart=unless-stopped \
|
||
--privileged \
|
||
--name=kuboard \
|
||
-p 80:80/tcp \
|
||
-p 10081:10081/tcp \
|
||
-e KUBOARD_ENDPOINT="http://内网IP:80" \
|
||
-e KUBOARD_AGENT_SERVER_TCP_PORT="10081" \
|
||
-v /root/kuboard-data:/data \
|
||
swr.cn-east-2.myhuaweicloud.com/kuboard/kuboard:v3
|
||
```
|
||
|
||
### Kubernetes部署
|
||
|
||
1. 创建数据存储目录
|
||
|
||
```bash
|
||
mkdir -p /usr/share/kuboard/etcd/ && chmod 700 /usr/share/kuboard/etcd/
|
||
```
|
||
|
||
2. 部署Kuboard
|
||
|
||
```bash
|
||
kubectl apply -f https://addons.kuboard.cn/kuboard/kuboard-v3.yaml
|
||
```
|
||
|
||
> 某些情况下,您的 Master 节点只有一个或者两个,却仍然想要保证 Kubuoard-Etcd 的高可用,此时,您可以通过为一到两个 Worker 节点添加 `k8s.kuboard.cn/role=etcd` 的标签,来增加 Kubuoard-Etcd 的实例数量
|
||
>
|
||
> ```bash
|
||
> kubectl label nodes <Worker-Node-Name> k8s.kuboard.cn/role=etcd
|
||
> ```
|
||
|
||
3. 部署
|
||
|
||
```bash
|
||
kubectl apply -f https://addons.kuboard.cn/kuboard/kuboard-v3.yaml
|
||
```
|
||
|
||
### 使用 StorageClass 提供持久化部署
|
||
|
||
[官方文档](https://kuboard.cn/install/v3/install-in-k8s.html#%E6%96%B9%E6%B3%95%E4%BA%8C-%E4%BD%BF%E7%94%A8-storageclass-%E6%8F%90%E4%BE%9B%E6%8C%81%E4%B9%85%E5%8C%96)
|
||
|
||
### 高可用部署
|
||
|
||
[官方文档](https://kuboard.cn/install/v3/install-ha.html#%E5%AE%89%E8%A3%85-kuboard-v3-%E9%AB%98%E5%8F%AF%E7%94%A8%E9%83%A8%E7%BD%B2)
|
||
|
||
## 卸载Kuboard
|
||
|
||
1. 卸载
|
||
|
||
```bash
|
||
kubectl delete -f https://addons.kuboard.cn/kuboard/kuboard-v3.yaml
|
||
```
|
||
|
||
2. 删除数据
|
||
|
||
```bash
|
||
rm -rf /usr/share/kuboard
|
||
```
|
||
|
||
|