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:
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:
helm repo add greptime https://greptimeteam.github.io/helm-charts/
helm repo update
helm install gtcloud greptime/greptimedb-operator -n default --devel
The maintained Helm charts are in helm-charts.
3. Create your own etcd cluster
helm install etcd greptime/greptimedb-etcd -n default --devel
4. Create your own GreptimeDB cluster
Create GreptimeDB cluster:
helm install mydb greptime/greptimedb -n default --devel
If you already have the etcd cluster, you can configure the etcd cluster:
helm install mycluster greptime/greptimedb --set etcdEndpoints=<your-etcd-cluster-endpoints> \
-n default --devel
After the installation, you can use kubectl port-forward
to access GreptimeDB cluster:
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:
# Uninstall the cluster.
helm uninstall mydb
# Uninstall etcd.
helm uninstall etcd -n default
# Uninstall the operator.
helm uninstall gtcloud
# Delete crds.
kubectl delete crds greptimedbclusters.greptime.io
gtctl
gtctl, g-t-control, is a command-line tool for managing the GreptimeDB clusters. gtctl is the all-in-one binary that integrates with multiple operations of GreptimeDB clusters.
1. Create a test Kubernetes cluster
You can use kind to create your own test Kubernetes
cluster:
kind create cluster
2. Install gtctl
Currently, gtctl
supports Linux
and Darwin
on x86_64
and ARM64
.
curl -L https://raw.githubusercontent.com/greptimeteam/gtctl/develop/hack/install.sh | sh
3. Create your own GreptimeDB cluster
./gtctl cluster create mydb -n default
After the installation is completed, gtctl
creates the followings:
etcd
clusterfrontend
instances (default replicas is 1)datanode
instances(default replicas is 3)metasrv
service(default replicas is 1)
You can use kubectl port-forward
command to forward frontend requests:
kubectl port-forward svc/mydb-frontend 4002:4002 > connections.out &
4. Delete your own GreptimeDB cluster
./gtctl cluster delete mydb --tear-down-etcd