GithubHelp home page GithubHelp logo

taohuixiang / starrocks-kubernetes-operator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from starrocks/starrocks-kubernetes-operator

0.0 1.0 0.0 451 KB

License: Apache License 2.0

Go 95.65% Makefile 4.00% Dockerfile 0.35%

starrocks-kubernetes-operator's Introduction

StarRocks-Kubernetes-Operator

License

Overview

(under development)
This operator is developed with kubebuilder, which can deploy StarRocks CRD resources in kubernetes.

This Kubernetes Operator is able to deploy StarRocks' Front End (FE), Back End (BE) and Compute Node (CN) components into your kubernetes environment. These components run in FQDN (fully qualified domain name) mode by default.

Requirements

  • kubernetes 1.18+
  • golang 1.18+

Supported Features

  • FE decouples with CN and BE. FE is a must-have component, BE and CN can be optionally deployed.
  • Support v2 horizontalpodautoscalers for CN cluster.

(Optional) Build the operator images by yourself

Get the official operator image from here.

Build starrocks operator docker image

Follow below instructions if you want to build your own image.

DOCKER_BUILDKIT=1 docker build -t starrocks-kubernetes-operator/operator:<tag> .

E.g.

DOCKER_BUILDKIT=1 docker build -t starrocks-kubernetes-operator/operator:latest .

Publish starrocks operator docker image

docker push ghcr.io/OWNER/starrocks-kubernetes-operator/operator:latest

E.g. Publish image to ghcr

docker push ghcr.io/dengliu/starrocks-kubernetes-operator/operator:latest

Install Operator in kubernetes

Apply the custom resource definition (CRD) for the Operator:

kubectl apply -f https://raw.githubusercontent.com/StarRocks/starrocks-kubernetes-operator/main/deploy/starrocks.com_starrocksclusters.yaml

Apply the Operator manifest. By default, the Operator is configured to install in the starrocks namespace. To use the Operator in a custom namespace, download the Operator manifest and edit all instances of namespace: starrocks to specify your custom namespace. Then apply this version of the manifest to the cluster with kubectl apply -f {local-file-path} instead of using the command below.

kubectl apply -f https://raw.githubusercontent.com/StarRocks/starrocks-kubernetes-operator/main/deploy/operator.yaml

Deploy StarRocks

You need to prepare a separate yaml file to deploy the StarRocks FE, BE and CN components. The starrocks cluster CRD fields explains in api.md. The examples directory contains some simple example for reference.

You can use any of the template yaml file as a starting point. You can further add more configurations into the template yaml file following this deployment documentation.

Configure the StarRocks' components images

Official FE/CN/BE components images can be found from dockerhub:

You can specify the image name in the yaml file. For example, the below configuration uses the starrocks/alpine-fe:2.4.1 image for FE.

starRocksFeSpec:
  image: starrocks/alpine-fe:2.4.1

(Optional) Using ConfigMap to configure your StarRocks cluster

The official images contains default application configuration file, however, they can be overritten by configuring kubernetes configmap deployment crd.

You can generate the configmap from an StarRocks configuration file. Below is an example of creating a Kubernetes configmap fe-config-map from the fe.conf configuration file. You can do the same with BE and CN.

# create fe-config-map from starrocks/fe/conf/fe.conf file
kubectl create configmap fe-config-map --from-file=starrocks/fe/conf/fe.conf

Once the configmap is created, you can reference the configmap in the yaml file. For example:

# fe use configmap example
starRocksFeSpec:
  configMapInfo:
    configMapName: fe-config-map
    resolveKey: fe.conf
# cn use configmap example
starRocksCnSpec:
  configMapInfo:
    configMapName: cn-config-map
    resolveKey: cn.conf
# be use configmap example
  starRocksBeSpec:
    configMapInfo:
    configMapName: be-config-map
    resolveKey: be.conf

(Optional) Configuring storage volume

External storage can be used to store FE meta and BE data for persistence. storageVolumes can be specified in corresponding component spec to enable external storage volumes auto provisioning. Note that the specific storageClassName should be available in kubernetes cluster before enabling this storageVolume feature.

If StorageVolume info is not specified in CRD spec, the operator will use emptydir mode to store FE meta and BE data.

FE storage example

starRocksFeSpec:
  storageVolumes:
    - name: fe-meta
      storageClassName: meta-storage
      storageSize: 10Gi
      mountPath: /opt/starrocks/fe/meta # overwrite the default meta path

BE storage example

starRocksBeSpec:
  storageVolumes:
    - name: be-data
      storageClassName: data-storage
      storageSize: 1Ti
      mountPath: /opt/starrocks/be/storage # overwrite the default data path

Deploy the StarRocks cluster

For demonstration purpose, we use the starrocks-fe-and-be.yaml example template to start a 3 FE and 3 BE StarRocks cluster.

kubectl apply -f starrocks-fe-and-be.yaml

Connect to the deployed StarRocks Cluster

After deploying the StarRocks cluster, you can use kubectl get svc -n <namespace> to find the IP to connect to. For example if the namespace that starrocks is deployed into is starrocks, you can:

kubectl get svc -n starrocks

<your-StarRocksCluster-name>-fe-service's clusterIP is the IP to use to connect to StarRocks FE.

Stop the StarRocks cluster

Delete the custom resource:

kubectl delete -f starrocks-fe-and-be.yaml

Remove the Operator:

kubectl delete -f  https://raw.githubusercontent.com/StarRocks/starrocks-kubernetes-operator/main/deploy/operator.yaml

Others

helm

StarRocks have supported helm use.
helm chart. github repo

starrocks-kubernetes-operator's People

Contributors

shileifu avatar 2585453704 avatar dengliu avatar kevincai avatar ss892714028 avatar dxheming avatar wangruin avatar imay avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.