Deploying Doris Operator
Add Doris Cluster resource definition
Doris Operator extends Kubernetes with Custom Resource Definition (CRD). The CRD of Doris Cluster encapsulates the description of Doris objects, such as the description of FE or BE. For details, please refer to [doris-operator-api](https://github.com/selectdb/doris-operator/blob/master /doc/api.md). Before deploying Doris, you need to create the CRD of Doris Cluster.
Doris Cluster CRD can be deployed in a Kubernetes environment with the following command:
kubectl create -f https://raw.githubusercontent.com/selectdb/doris-operator/master/config/crd/bases/doris.selectdb.com_dorisclusters.yaml
If there is no external network, download the CRD file to your local computer first:
wget https://raw.githubusercontent.com/selectdb/doris-operator/master/config/crd/bases/doris.selectdb.com_dorisclusters.yaml
kubectl create -f ./doris.selectdb.com_dorisclusters.yaml
The following is the expected output:
customresourcedefinition.apiextensions.k8s.io/dorisclusters.doris.selectdb.com created
After the Doris Cluster CRD is created, you can view the created CRD with the following command.
kubectl get crd | grep doris
The following is the expected output:
dorisclusters.doris.selectdb.com 2024-02-22T16:23:13Z
Add Doris Operator
Solution 1: Quickly deploy Doris Operator
You can directly pull the Doris Operator template in the warehouse for quick deployment.
Doris Operator can be deployed in a Kubernetes cluster using the following command:
kubectl apply -f https://raw.githubusercontent.com/selectdb/doris-operator/master/config/operator/operator.yaml
The following is the expected output:
namespace/doris created
role.rbac.authorization.k8s.io/leader-election-role created
rolebinding.rbac.authorization.k8s.io/leader-election-rolebinding created
clusterrole.rbac.authorization.k8s.io/doris-operator created
clusterrolebinding.rbac.authorization.k8s.io/doris-operator-rolebinding created
serviceaccount/doris-operator created
deployment.apps/doris-operator created
Option 2: Customized deployment of Doris Operator
After creating the CRD, there are two ways to deploy Doris Operator on the Kubernetes cluster: online and offline deployment.
The minimum requirements for deploying operator services are specified in the operator.yaml file. In order to adapt to complex production environments, you can download the operator.yaml file and update the configuration as desired.
Install Doris Operator online
After modifying the operator.yaml file, you can deploy the Doris Operator service using the following command:
kubectl apply -f ./operator.yaml
The following is the expected output:
namespace/doris created
role.rbac.authorization.k8s.io/leader-election-role created
rolebinding.rbac.authorization.k8s.io/leader-election-rolebinding created
clusterrole.rbac.authorization.k8s.io/doris-operator created
clusterrolebinding.rbac.authorization.k8s.io/doris-operator-rolebinding created
serviceaccount/doris-operator created
deployment.apps/doris-operator created
Offline installation of Doris Operator
- Download the image file required to run the operator
If the server is not connected to the external network, you need to download the corresponding operator image file first. Doris Operator uses the following images:
selectdb/doris.k8s-operator:latest
Run the following command on a server that can connect to the external network to download the image:
## download doris operator image
docker pull selectdb/doris.k8s-operator:latest
## save the doris operator image as a tar package
docker save -o doris.k8s-operator-latest.tar selectdb/doris.k8s-operator:latest
Place the packaged tar file into all Kubernetes nodes and run the following command to upload the image:
docker load -i doris.k8s-operator-latest.tar
- Configure Doris Operator
After downloading the operator.yaml file, you can modify the template according to your production environment expectations.
Doris Operator is a stateless Deployment in the Kubernetes cluster. Items such as limits
, replica
, label
, namespace
and other items can be modified according to needs. If you need to specify a certain version of the doirs operator image, you can make the following modifications to the operator.yaml file after uploading the image:
...
containers:
- command:
- /dorisoperator
args:
- --leader-elect
image: selectdb/doris.k8s-operator:v1.0.0
name: dorisoperator
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- "ALL"
...
- Install Doris Operator
After modifying the Doris Operator template, you can use the apply command to deploy the Operator:
kubectl apply -f ./operator.yaml
The following is the expected output:
namespace/doris created
role.rbac.authorization.k8s.io/leader-election-role created
rolebinding.rbac.authorization.k8s.io/leader-election-rolebinding created
clusterrole.rbac.authorization.k8s.io/doris-operator created
clusterrolebinding.rbac.authorization.k8s.io/doris-operator-rolebinding created
serviceaccount/doris-operator created
deployment.apps/doris-operator created
Option 3: Helm deploys Doris Operator
Helm Chart is an encapsulation of a series of YAML files that describe Kubernetes-related resources. When deploying an application through Helm, you can customize the application's metadata to facilitate application distribution. Chart is a Helm package in TAR format for deploying Kubernetes native applications. Helm Chart can simplify the process of deploying Doris clusters.
- Add a deployment warehouse
Add warehouse online
Add the remote repository through the repo add
command
helm repo add doris-repo https://charts.selectdb.com
Update the latest version of the chart through the repo update
command
helm repo update doris-repo
- Install Doris Operator
Doris Operator can be installed in the doris namespace using the default configuration through the helm install
command.
helm install operator doris-repo/doris-operator
If you need to customize the assembly values.yaml, you can refer to the following command:
helm install -f values.yaml operator doris-repo/doris-operator
Check the deployment status of Pods through the kubectl get pods
command. When the Doris Operator's Pod is in the Running state and all containers in the Pod are ready, the deployment is successful.
kubectl get pod --namespace doris
The return result is as follows:
NAME READY STATUS RESTARTS AGE
doris-operator-866bd449bb-zl5mr 1/1 Running 0 18m
Add warehouse offline
If the server cannot connect to the external network, you need to download the chart resources of Doris Operator and Doris Cluster in advance.
- Download offline chart resources
Download doris-operator-{chart_version}.tgz
to install Doris Operator chart. If you need to download version 1.4.0 of Doris Operator, you can use the following command:
wget https://charts.selectdb.com/doris-operator-1.4.0.tgz
- Install Doris Operator
Doris Operator can be installed through the helm install
command.
helm install operator doris-operator-1.4.0.tgz
If you need to customize the assembly values.yaml, you can refer to the following command:
helm install -f values.yaml operator doris-operator-1.4.0.tgz
Check the deployment status of Pods through the kubectl get pods
command. When the Doris Operator's Pod is in the Running state and all containers in the Pod are ready, the deployment is successful.
kubectl get pod --namespace doris
The return result is as follows:
NAME READY STATUS RESTARTS AGE
doris-operator-866bd449bb-zl5mr 1/1 Running 0 18m
Check service status
After deploying the Operator service, you can check the service status through the following command.
kubectl get pod -n doris
The return result is as follows:
NAME READY STATUS RESTARTS AGE
doris-operator-6f47594455-p5tp7 1/1 Running 0 11s
You need to ensure that the STATUS status is Running and the status of all containers in the pod is Ready.