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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new b9444540f26 [doc](fix) a new docs for k8s deploy by operator to 2.0 
(#26927)
b9444540f26 is described below

commit b9444540f2653a18bbdbeabd1b0b65fe36ea7069
Author: catpineapple <42031973+catpineap...@users.noreply.github.com>
AuthorDate: Tue Nov 21 11:02:51 2023 +0800

    [doc](fix) a new docs for k8s deploy by operator to 2.0 (#26927)
---
 docs/en/docs/install/k8s-deploy.md    | 162 ++++++++++++++++++++--------------
 docs/zh-CN/docs/install/k8s-deploy.md | 161 +++++++++++++++++++--------------
 2 files changed, 194 insertions(+), 129 deletions(-)

diff --git a/docs/en/docs/install/k8s-deploy.md 
b/docs/en/docs/install/k8s-deploy.md
index 408de23158c..10b845a64db 100644
--- a/docs/en/docs/install/k8s-deploy.md
+++ b/docs/en/docs/install/k8s-deploy.md
@@ -1,7 +1,7 @@
 ---
 {
-"title": "Kubernetes Deployment",
-"language": "en"
+  "title": "Deploy Doris on Kubernetes",
+  "language": "en"
 }
 ---
 
@@ -24,66 +24,98 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-# K8s Deployment Doris
-
-<version since="dev"></version>
-
-## Environmental Preparation
-
-- Installation k8s
-- Build or download a Doris image
-    - Building an image [Build Docker 
Image](./construct-docker/construct-docker-image)
-    - Download Image https://hub.docker.com/r/apache/doris/tags
-- Create or download the yml file for Doris on k8s
-    - 
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
-
-## Starting A Cluster
-Start FE (role type is Follower):`kubectl create -f doris_follower.yml` 
-
-Start BE:`kubectl create -f doris_be.yml` 
-
-Start the BE (role type is Compute Node):`kubectl create -f doris_cn.yml`
-
-## Expansion and Contraction Capacity
-
-- FE
-  - Currently, scaling is not supported. It is recommended to initialize 1 or 
3 nodes as needed
-- BE
-  - Command:`kubectl scale statefulset doris-be-cluster1 --replicas=4`
-- BE (role type is Compute Node)
-  - Command:`kubectl scale statefulset doris-cn-cluster1 --replicas=4`
-
-## Test and Verify
-
-Connect to the FE using mysql-client and perform operations such as' show 
backends' and 'show frontends' to view the status of each node
-
-## K8s Simple Operation Command
-
-- Executing the yml file for the first time `kubectl create -f xxx.yml`
-- Execute after modifying the yml file `kubectl apply -f xxx.yml`
-- Delete all resources defined by yml `kubectl delete -f xxx.yml`
-- View the pod list `kubectl get pods`
-- Entering the container `kubectl exec -it xxx(podName) -- /bin/sh`
-- view log `kubectl logs xxx(podName)`
-- View IP and port information `kubectl get ep`
-- [More knowledge of k8s](https://kubernetes.io)
-
-## Common Problem
-
-- How is data persistent?
-
-  Users need to mount PVC on their own to persist metadata information, data 
information, or log information
-- How to safely shrink the BE node?
-
-  BE:User manual execution is required before current 
resizing[ALTER-SYSTEM-DECOMMISSION-BACKEND](../../sql-manual/sql-reference/Cluster-Management-Statements/ALTER-SYSTEM-DECOMMISSION-BACKEND)
-
-  BE(The role type is Compute Node): Do not store data files and can directly 
shrink,[About Computing Nodes](../../advanced/compute_node)
-- FE startup error "failed to init statefulSetName"
-
-  doris_ The environment variables statefulSetName and serviceName for 
follower. yml must appear in pairs, such as CN configured_ SERVICE, CN must be 
configured_ STATEFULSET
-
-
-
-
+Doris-Operator is software extension to Kubernetes that make use of custom 
resource to manage Doris and it components. It provides 
[DorisCluster](https://github.com/selectdb/doris-operator/blob/master/config/crd/bases/doris.selectdb.com_dorisclusters.yaml)
 a Kubernetes 
[CustomResourceDefinition](https://kubernetes.io/docs/reference/kubernetes-api/extend-resources/custom-resource-definition-v1/)
 for user to custom resource.
+## Deploy Doris on Kubernetes
+
+### Start Kubernetes
+Having a Kubernetes environment is the premise to deploy Doris on Kubernetes. 
If you already have it, please ignore this step. 
+Hosted Kubernetes on cloud platform or set-up by yourself are all good choice. 
 
+
+**Hosted EKS**  
+1. Check that the following 
[command-line](https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html)
 tools are installed in your environment:  
+- Install and configure AWS command-line tool AWS CLI.
+- Install EKS cluster command-line tool eksctl.
+- Install Kubernetes cluster command-line tool kubectl. 
+
+2. Use one of the following methods to create an EKS cluster:  
+- [Use eksctl to quickly create an EKS 
cluster](https://docs.aws.amazon.com/eks/latest/userguide/getting-started-eksctl.html).
+- [Manually create an EKS cluster with the AWS console and AWS 
CLI](https://docs.aws.amazon.com/eks/latest/userguide/getting-started-console.html).
+
+**Hosted GKE**    
+Complete all the 
[prerequisites](https://cloud.google.com/kubernetes-engine/docs/deploy-app-cluster#before-you-begin)
 when [create a GKE 
cluster](https://cloud.google.com/kubernetes-engine/docs/deploy-app-cluster#create_cluster).
  
+
+**Create as Kubernetes recommend**    
+Kubernetes official documents recommends some ways to set up Kubernetes, as 
[minikube](https://minikube.sigs.k8s.io/docs/start/),[kOps](https://kubernetes.io/zh-cn/docs/setup/production-environment/tools/kops/).
+
+### Deploy Doris-Operator on Kubernetes
+**1. Apply the [Custom Resource 
Definition(CRD)](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#customresourcedefinitions)**
  
+```shell
+kubectl apply -f 
https://raw.githubusercontent.com/selectdb/doris-operator/master/config/crd/bases/doris.selectdb.com_dorisclusters.yaml
    
+```
+**2. Install Doris-Operator**  
+If you want to use the defaults operator resource:
+```shell
+kubectl apply -f 
https://raw.githubusercontent.com/selectdb/doris-operator/master/config/operator/operator.yaml
+```  
+The user defined deployment in github repo are simply:  
+Instead of using the command below, apply your local version of the Operator 
manifest to the cluster when you custom operator resource.
+```shell
+kubectl apply -f operator.yaml  
+```  
+**3. Validate The Operator is Running**  
+Using the command `kubectl -n {namespace} get pods` get the status of deployed 
operator. 
+```shell
+ kubectl -n doris get pods
+ NAME                              READY   STATUS    RESTARTS        AGE
+ doris-operator-5b9f7f57bf-tsvjz   1/1     Running   66 (164m ago)   6d22h
+```
+Expected result, the Pod `STATUS` is `Running` and all containers in Pod are 
all `READY`.
+
+### Start Doris on Kubernetes
+**1. Initialize Doris Cluster**    
+User can directly deploy Doris by 
[examples](https://github.com/selectdb/doris-operator/tree/master/doc/examples) 
provided by Doris-Operator. Below is the command:    
+```shell
+kubectl apply -f 
https://raw.githubusercontent.com/selectdb/doris-operator/master/doc/examples/doriscluster-sample.yaml
  
+```
+Or download 
[doriscluster-sample](https://github.com/selectdb/doris-operator/master/doc/examples/doriscluster-sample.yaml)
 a custom resource that tells the Operator how to configure the Kubernetes 
cluster, and custom resource as 
[api.md](https://github.com/selectdb/doris-operator/blob/master/doc/api.md) and 
+[how_to_use](https://github.com/selectdb/doris-operator/tree/master/doc/how_to_use.md)
 docs. Instead of using the command below, apply the customized resource.
+```shell
+kubeectl apply -f doriscluster-sample.yaml  
+```
+**2. Validate Doris Cluster Status**  
+Using the command `kubectl -n {namespace} get pods` check pods status.
+```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
+```
+All Pods created by DorisCluster resource should be in `Running` STATUS, and 
each pod's containers should be `RREADY`.
+### Use Doris Cluster  
+On kubernetes Doris-Operator provide `Service` a resource build in kubernetes 
for access to Doris.  
+
+The command `kubectl -n {namespace} get svc -l 
"app.doris.ownerreference/name={dorisCluster.Name}"` used to get `service` 
created by Doris-Operator. `dorisCluster.Nmae` is the name of DorisCluster 
resource deployed by step 1.
+```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
+```
+**Use SQL Client for Access**  
+Service created by Doris-Operator have two types, suffix is `-internal` or 
`-service`. Service have the `-internal` suffix for communicating in Doris 
components, Service have `-service` suffix for user to access.  
+
+- In Kubernetes  
+  In kubernetes, Using `CLUSTER-IP`  is recommended. For example, the fe 
service's `CLUSTER-IP`  is `10.152.183.37` that displayed by above command. 
Using below command to access fe service.
+
+  ```shell
+  mysql -h 10.152.183.37 -uroot -P9030
+  ```
+
+- Out Kubernetes  
+Using `EXTERNAL-IP` to access fe from Kubernetes external. In default, 
Doris-Operator not provided `EXTERNAL-IP` mode. If you want to use 
`EXTERNAL-IP`, should custom resource `Service` field, reference the doc 
[api.md](https://github.com/selectdb/doris-operator/blob/master/doc/api.md) to 
deploy.
+
+:::tip
+If the doc not cover your requirements, Pleaser reference the docs 
[how_to_use.md](https://github.com/selectdb/doris-operator/tree/master/doc/how_to_use.md)
 and 
[api.md](https://github.com/selectdb/doris-operator/blob/master/doc/api.md) to 
custom `DorisCluster` resource to deploy.
+:::
\ No newline at end of file
diff --git a/docs/zh-CN/docs/install/k8s-deploy.md 
b/docs/zh-CN/docs/install/k8s-deploy.md
index 6fa7111642e..180322f613b 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
-
-<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 大规模形态下智能化和并行化管理。
+
+## Kubernetes 上部署 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
 资源的 [api](https://github.com/selectdb/doris-operator/blob/master/doc/api.md) 
可读性文档定制化部署 Doris 集群。
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to