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
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
helm repo add greptime https://greptimeteam.github.io/helm-charts/
shell
helm repo update
shell
helm install gtcloud greptime/greptimedb-operator -n default --devel
The maintained Helm charts are in helm-charts.
3. Create your own GreptimeDB cluster
Create an etcd cluster for GreptimeDB:
shell
helm install etcd greptime/greptimedb-etcd -n default --devel
Create a GreptimeDB cluster which uses the etcd cluster created at previous step:
shell
helm install mydb greptime/greptimedb -n default --devel
Or, if you already have an etcd cluster, you can use etcdEndpoints
to use your etcd cluster:
shell
helm install mycluster greptime/greptimedb --set etcdEndpoints=<your-etcd-cluster-endpoints> \
-n default --devel
After the installation, you can use kubectl port-forward
to forward the MySQL protocol port of the GreptimeDB cluster:
shell
kubectl port-forward svc/mydb-frontend 4002:4002 > connections.out &
Then you can use MySQL client to connect to the cluster.
4. Destroy GreptimeDB cluster
You can use the following commands to uninstall operator and cluster:
shell
# Uninstall the cluster.
helm uninstall mydb
shell
# Uninstall etcd.
helm uninstall etcd -n default
shell
# Uninstall the operator.
helm uninstall gtcloud
shell
# Delete crds.
kubectl delete crds greptimedbclusters.greptime.io