This section describes how to deploy Doris Operator and Doris cluster in the test Kubernetes cluster. The deployment operations are as follows:

  1. Create a Kubernetes test cluster
  2. Deploy Doris Operator
  3. Deploy Doris cluster
  4. Connect to Doris cluster

Step 1: Create a Kubernetes test cluster

This step briefly describes how to quickly build a single-node k8s cluster without a k8s cluster. If you already have a k8s cluster, please skip this step. Kind is currently a common solution for creating a local Kubernetes test environment. Kind uses Docker containers as nodes to create and run Kubernetes clusters locally.

  1. Deployment prerequisites Before deployment, you need to ensure that the following components are available in the environment:
ComponentsVersion requirements
Docker>= 18.09
kubectl>=1.19
kind>=0.8.0
  1. Deploy Kubernetes cluster using kind In this example, kind 0.10.0 is used to install the Kubernetes cluster. The command is as follows:

    1. kind create cluster --image kindest/node:v1.20.2 --name test-doris

    Expected output:

    1. Creating cluster "test-doris" ...
    2. Ensuring node image (kindest/node:v1.20.2)
    3. Preparing nodes
    4. Writing configuration
    5. Starting control-plane
    6. Installing CNI
    7. Installing StorageClass
    8. Set kubectl context to "kind-test-doris"
    9. You can now use your cluster with:
  2. Check the Kubernetes cluster status Use the following command to check the Kubernetes cluster status:

    1. kubectl cluster-info --context kind-test-doris

    Expected output:

    1. Kubernetes control plane is running at https://127.0.0.1:40075
    2. KubeDNS is running at https://127.0.0.1:40075/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
    3. To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

Step 2: Deploy Doris Operator

Deploying Doris Operator consists of two parts: installing the definition and deploying the operator service:

  1. Installing Doris Operator CRD Add the custom resource (CRD) of Doris Operator using the following command:

    1. kubectl apply -f https://raw.githubusercontent.com/selectdb/doris-operator/master/config/crd/bases/doris.selectdb.com_dorisclusters.yaml

    Expected output:

    1. customresourcedefinition.apiextensions.k8s.io/dorisclusters.doris.selectdb.com created
  2. Install Doris Operator Install Doris Operator using the following command:

    1. kubectl apply -f https://raw.githubusercontent.com/selectdb/doris-operator/master/config/operator/operator.yaml

    Expected output:

    1. namespace/doris created
    2. role.rbac.authorization.k8s.io/leader-election-role created
    3. rolebinding.rbac.authorization.k8s.io/leader-election-rolebinding created
    4. clusterrole.rbac.authorization.k8s.io/doris-operator created
    5. clusterrolebinding.rbac.authorization.k8s.io/doris-operator-rolebinding created
    6. serviceaccount/doris-operator created
    7. deployment.apps/doris-operator created
  3. Check the Doris Operator status Check the deployment status of Doris Operator using the following command:

    1. kubectl get pods -n doris

    Expected output:

    1. NAME READY STATUS RESTARTS AGE
    2. doris-operator-7f578c86cb-nz6jn 1/1 Running 0 19m

    For Doris Operator related configuration and other deployment methods, please refer to Deploying Doris Operator.

Step 3: Deploy Doris cluster

  1. Download the template Doris deployment template:

    1. curl -O https://raw.githubusercontent.com/apache/doris-operator/master/doc/examples/doriscluster-sample.yaml
  2. Perform customized configuration as needed according to the Deploying Doris Cluster. After the configuration is completed, deploy it with the following command:

    1. kubectl apply -f doriscluster-sample.yaml
  3. Check the cluster deployment status: Check the status of the cluster by checking the status of pods:

    1. kubectl get pods

    Expected output:

    1. NAME READY STATUS RESTARTS AGE
    2. doriscluster-sample-fe-0 1/1 Running 0 2m
    3. doriscluster-sample-be-0 1/1 Running 0 3m

    Check the status of the deployed resources:

    1. kubectl get dcr -n doris

    Expected output:

    1. NAME FESTATUS BESTATUS CNSTATUS BROKERSTATUS
    2. doriscluster-sample available available

Step 4: Connect and access the Doris cluster

The Doris cluster is quickly deployed in the test environment. You can enter the container FE and use the MySQL Client to connect to Doris for test operations. For other access methods, refer to Accessing Doris Cluster for configuration.

  1. Get the FE container name:

    1. kubectl get pod -n doris | grep fe
    2. doriscluster-sample-fe-0 1/1 Running 0 16m

    In this example, the FE container is named doriscluster-sample-fe-0.

  2. Enter the FE container:

    1. kubectl -n doris exec -it doriscluster-sample-fe-0 /bin/bash
  3. Use MySQL Client to connect to the Doris cluster in the FE container:

    1. mysql -uroot -P9030 -h127.0.0.1