Kubernetes

GreptimeDB Operator

By utilizing the Operator pattern, GreptimeDB Operator can effectively manage GreptimeDB clusters on Kubernetes. This operator abstracts the model of maintaining a highly available GreptimeDB cluster.

1. Create a test Kubernetes cluster

You can use kind to create your own test Kubernetes cluster:

shell

  1. kind create cluster

2. Use Helm to install GreptimeDB Operator

Make sure you have already installed Helm. Use the following commands to install greptimedb-operator in the default namespace:

shell

  1. helm repo add greptime https://greptimeteam.github.io/helm-charts/

shell

  1. helm repo update

shell

  1. helm install gtcloud greptime/greptimedb-operator -n default --devel

The maintained Helm charts are in helm-charts.

3. Create your own etcd cluster

shell

  1. helm install etcd greptime/greptimedb-etcd -n default --devel

4. Create your own GreptimeDB cluster

Create GreptimeDB cluster:

shell

  1. helm install mydb greptime/greptimedb -n default --devel

If you already have the etcd cluster, you can configure the etcd cluster:

shell

  1. helm install mycluster greptime/greptimedb --set etcdEndpoints=<your-etcd-cluster-endpoints> \
  2. -n default --devel

After the installation, you can use kubectl port-forward to access GreptimeDB cluster:

shell

  1. kubectl port-forward svc/mydb-frontend 4002:4002 > connections.out &

5. Destroy GreptimeDB cluster

You can use the following commands to uninstall operator and cluster:

shell

  1. # Uninstall the cluster.
  2. helm uninstall mydb

shell

  1. # Uninstall etcd.
  2. helm uninstall etcd -n default

shell

  1. # Uninstall the operator.
  2. helm uninstall gtcloud

shell

  1. # Delete crds.
  2. kubectl delete crds greptimedbclusters.greptime.io