This is an automated email from the ASF dual-hosted git repository.

zykkk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new da732e5f5b6 [doc](fix) a new docs for k8s deploy by operator (#26508)
da732e5f5b6 is described below

commit da732e5f5b60d91029297b3041acb2ce12f98a8e
Author: catpineapple <[email protected]>
AuthorDate: Tue Nov 14 20:05:28 2023 +0800

    [doc](fix) a new docs for k8s deploy by operator (#26508)
---
 docs/zh-CN/docs/install/k8s-deploy.md | 157 ++++++++++++++++++++--------------
 1 file changed, 95 insertions(+), 62 deletions(-)

diff --git a/docs/zh-CN/docs/install/k8s-deploy.md 
b/docs/zh-CN/docs/install/k8s-deploy.md
index 6fa7111642e..06b34efa6da 100644
--- a/docs/zh-CN/docs/install/k8s-deploy.md
+++ b/docs/zh-CN/docs/install/k8s-deploy.md
@@ -1,7 +1,7 @@
 ---
 {
-  "title": "Kubernetes 部署",
-  "language": "zh-CN"
+      "title": "基于 Doris-Operator 部署",
+      "language": "zh-CN"
 }
 ---
 
@@ -24,66 +24,99 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-# K8s部署doris
+## Kubernetes 上部署 Doris 集群
 
 <version since="dev"></version>
-
-## 环境准备
-
-- 安装 k8s
-- 构建或下载doris镜像
-    - 构建镜像 [构建 Docker Image](./construct-docker/construct-docker-image) 
-    - 下载镜像 https://hub.docker.com/r/apache/doris/tags
-- 创建或下载doris on k8s的yml文件
-    - 
https://github.com/apache/doris/blob/master/docker/runtime/k8s/doris_follower.yml
-    - 
https://github.com/apache/doris/blob/master/docker/runtime/k8s/doris_be.yml
-    - 
https://github.com/apache/doris/blob/master/docker/runtime/k8s/doris_cn.yml
-
-## 启动集群
-启动 FE(角色类型为 Follower):`kubectl create -f doris_follower.yml` 
-
-启动 BE :`kubectl create -f doris_be.yml` 
-
-启动 BE(角色类型为 Compute Node):`kubectl create -f doris_cn.yml`
-
-## 扩缩容
-
-- FE
-  - 目前不支持扩缩容,建议按需初始化1个或者3个节点
-- BE
-  - 命令:`kubectl scale statefulset doris-be-cluster1 --replicas=4`
-- BE(角色类型为 Compute Node)
-  - 命令:`kubectl scale statefulset doris-cn-cluster1 --replicas=4`
-
-## 验证
-
-使用 mysql-client 连接到 FE,执行 `show backends`,`show frontends`等操作查看各节点状态
-
-## k8s简易操作命令
-
-- 首次执行yml文件 `kubectl create -f xxx.yml`
-- 修改yml文件后执行 `kubectl apply -f xxx.yml`
-- 删除yml定义的所有资源 `kubectl delete -f xxx.yml`
-- 查看pod列表 `kubectl get pods`
-- 进入容器 `kubectl exec -it xxx(podName) -- /bin/sh`
-- 查看日志 `kubectl logs xxx(podName)`
-- 查看ip和端口信息 `kubectl get ep`
-- [更多k8s知识](https://kubernetes.io)
-
-## 常见问题
-
-- 数据怎么持久化?
-
-  用户需要自行挂载pvc,持久化元数据信息,数据信息或者日志信息等
-- 怎么安全缩容BE节点?
-
-  
BE:当前缩容之前需要用户手动执行[ALTER-SYSTEM-DECOMMISSION-BACKEND](../../sql-manual/sql-reference/Cluster-Management-Statements/ALTER-SYSTEM-DECOMMISSION-BACKEND)
-
-  BE(角色类型为 Compute Node): 
不存储数据文件,可以直接进行缩容,[关于计算节点](../../advanced/compute_node)
-- FE启动报错"failed to init statefulSetName"
-
-  doris_follower.yml的环境变量 
statefulSetName和serviceName必须成对出现,比如配置了CN_SERVICE,就必须配置CN_STATEFULSET
-
-
-
+Doris-Operator 是按照 Kubernetes 原则构建的在 Kubernetes 平台之上管理运维 Doris 
集群的管理软件,允许用户按照资源定义的方式在 Kubernetes 平台之上部署管理 Doris 服务。Doris-Operator 能够管理 Doris 
的所有部署形态,能够实现 Doris 大规模形态下智能化和并行化管理。
+### 环境准备
+使用 Doris-Operator 部署 Doris 前提需要一个 Kubernetes (简称 K8S)集群,如果已拥有可直接跳过环境准备阶段。  
+  
+**创建 K8S 集群**  
+  
+用户可在喜欢的云平台上申请云托管的 K8S 集群服务,例如:[阿里云的 ACK 
](https://www.aliyun.com/product/kubernetes)或者[ 腾讯的 TKE 
](https://cloud.tencent.com/product/tke)等等,也可以按照 
[Kubernetes](https://kubernetes.io/docs/setup/) 官方推荐的方式手动搭建 K8S 集群。 
+- 创建 ACK 集群  
+您可按照阿里云官方文档在阿里云平台创建 [ACK 
集群](https://help.aliyun.com/zh/ack/ack-managed-and-ack-dedicated/getting-started/getting-started/)。
+- 创建 TKE 集群  
+如果你使用腾讯云可以按照腾讯云TKE相关文档创建 [TKE 
集群](https://cloud.tencent.com/document/product/457/54231)。
+- 创建私有集群  
+私有集群搭建,我们建议按照官方推荐的方式搭建,比如:[minikube](https://minikube.sigs.k8s.io/docs/start/),[kOps](https://kubernetes.io/zh-cn/docs/setup/production-environment/tools/kops/)。
+
+### 部署 Doris-Operator
+**1. 添加 DorisCluster 
[资源定义](https://kubernetes.io/zh-cn/docs/concepts/extend-kubernetes/api-extension/custom-resources/)**
+```shell
+kubectl apply -f 
https://raw.githubusercontent.com/selectdb/doris-operator/master/config/crd/bases/doris.selectdb.com_dorisclusters.yaml
    
+```
+**2. 部署 Doris-Operator**  
+   **方式一:默认部署模式**  
+   直接通过仓库中 Operator 的定义进行部署   
+   ```shell
+   kubectl apply -f 
https://raw.githubusercontent.com/selectdb/doris-operator/master/config/operator/operator.yaml
+   ```
+   **方式二:自定义部署**  
+   
[operator.yaml](https://github.com/selectdb/doris-operator/blob/master/config/operator/operator.yaml)
 中各个配置是部署 Operator 服务的最低要求。为提高管理效率或者有定制化的需求,下载 operator.yaml 进行自定义部署。  
+   - 下载 Operator 的部署范例 
[operator.yaml](https://raw.githubusercontent.com/selectdb/doris-operator/master/config/operator/operator.yaml),可直接通过
 wget 进行下载。
+   - 按期望更新 operator.yaml 中各种配置信息。
+   - 通过如下命令部署 Doris-Operator 服务。
+   ```shell
+   kubectl apply -f operator.yaml
+   ```
+**3. 检查 Doris-Operator 服务部署状态**   
+Operator 服务部署后,可通过如下命令查看服务的状态。当`STATUS`为`Running`状态,且 pod 
中所有容器都为`Ready`状态时服务部署成功。
+```
+ kubectl -n doris get pods
+ NAME                              READY   STATUS    RESTARTS        AGE
+ doris-operator-5b9f7f57bf-tsvjz   1/1     Running   66 (164m ago)   6d22h
+```
+operator.yaml 中 namespace 默认为 Doris,如果更改了 namespace,在查询服务状态的时候请替换正确的 namespace 
名称。
+### 部署 Doris 集群
+**1. 部署集群**   
+`Doris-Operator`仓库的 [doc/examples 
](https://github.com/selectdb/doris-operator/tree/master/doc/examples)目录提供众多场景的使用范例,可直接使用范例进行部署。以最基础的范例为例:
  
+```
+kubectl apply -f 
https://raw.githubusercontent.com/selectdb/doris-operator/master/doc/examples/doriscluster-sample.yaml
+```
+在 Doris-Operator 
仓库中,[how_to_use.md](https://github.com/selectdb/doris-operator/tree/master/doc/how_to_use.md)
 梳理了 Operator 管理运维 Doris 
集群的主要能力,[DorisCluster](https://github.com/selectdb/doris-operator/blob/master/api/doris/v1/types.go)
 
展示了资源定义和从属结构,[api.md](https://github.com/selectdb/doris-operator/tree/master/doc/api.md)
 可读性展示了资源定义和从属结构。可根据相关文档规划部署 Doris 集群。  
+
+**2. 检测集群状态**
+- 检查所有 pod 的状态  
+集群部署资源下发后,通过如下命令检查集群状态。当所有 pod 的`STATUS`都是`Running`状态, 且所有组件的 pod 
中所有容器都`READY`表示整个集群部署正常。
+  ```shell
+  kubectl get pods
+  NAME                       READY   STATUS    RESTARTS   AGE
+  doriscluster-sample-fe-0   1/1     Running   0          20m
+  doriscluster-sample-be-0   1/1     Running   0          19m
+  ```
+- 检查部署资源状态  
+  Doris-Operator 会收集集群服务的状态显示到下发的资源中。Doris-Operator 
定义了`DorisCluster`类型资源名称的简写`dcr`,在使用资源类型查看集群状态时可用简写替代。当配置的相关服务的`STATUS`都为`available`时,集群部署成功。
+  ```shell
+  kubectl get dcr
+  NAME                  FESTATUS    BESTATUS    CNSTATUS   BROKERSTATUS
+  doriscluster-sample   available   available
+  ```
+### 访问集群
+Doris-Operator 为每个组件提供 K8S 的 Service 作为访问入口,可通过`kubectl -n {namespace} get svc 
-l "app.doris.ownerreference/name={dorisCluster.Name}"`来查看 Doris 集群有关的 
Service。`dorisCluster.Name`为部署`DorisCluster`资源定义的名称。
+```shell
+kubectl -n default get svc -l 
"app.doris.ownerreference/name=doriscluster-sample"
+NAME                              TYPE        CLUSTER-IP       EXTERNAL-IP     
                                      PORT(S)                               AGE
+doriscluster-sample-fe-internal   ClusterIP   None             <none>          
                                      9030/TCP                              30m
+doriscluster-sample-fe-service    ClusterIP   10.152.183.37    
a7509284bf3784983a596c6eec7fc212-618xxxxxx.com        
8030/TCP,9020/TCP,9030/TCP,9010/TCP   30m
+doriscluster-sample-be-internal   ClusterIP   None             <none>          
                                      9050/TCP                              29m
+doriscluster-sample-be-service    ClusterIP   10.152.183.141   <none>          
                                      9060/TCP,8040/TCP,9050/TCP,8060/TCP   29m
+```
+Doris-Operator 部署的 Service 分为两类,后缀`-internal`为集群内部组件通信使用的 
Service,后缀`-service`为用户可使用的 Service。 
+  
+**集群内部访问**  
+  
+在 K8S 内部可通过 Service 的`CLUSTER-IP`访问对应的组件。如上图可使用访问 FE 的 
Service`doriscluster-sample-fe-service`对应的 CLUSTER-IP 为`10.152.183.37`,使用如下命令连接 
FE 服务。
+```shell
+mysql -h 10.152.183.37 -uroot -P9030
+```
+  
+**集群外部访问**  
+  
+Doris 集群部署默认不提供 K8S 外部访问,如果集群需要被集群外部访问,需要集群能够申请 lb 资源。具备前提后,参考 
[api.md](https://github.com/selectdb/doris-operator/blob/master/doc/api.md) 
文档配置相关组件`service`字段,部署后通过对应 Service 的`EXTERNAL-IP`进行访问。以上图中 FE 为例,使用如下命令连接:
+```shell
+mysql -h a7509284bf3784983a596c6eec7fc212-618xxxxxx.com -uroot -P9030
+```
+### 后记
+本文简述 Doris 在 Kubernetes 的部署使用,提供的其他能力请参看 
[Doris-Operator](https://github.com/selectdb/doris-operator/tree/master/doc/how_to_use.md)
 
提供的主要能力介绍,[DorisCluster](https://github.com/selectdb/doris-operator/blob/master/doc/api.md)
 资源的 api 可读性文档定制化部署 Doris 集群。
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to