Running on Kubernetes by Helm

This document describes how to run HStreamDB kubernetes using the helm chart that we provide. The document assumes basic previous kubernetes knowledge. By the end of this section, you’ll have a fully running HStreamDB cluster on kubernetes that’s ready to receive reads/writes, process datas, etc.

Building your Kubernetes Cluster

The first step is to have a running kubernetes cluster. You can use a managed cluster (provided by your cloud provider), a self-hosted cluster or a local kubernetes cluster using a tool like minikube. Make sure that kubectl points to whatever cluster you’re planning to use.

Also, you need a storageClass, you can create by kubectlor by your cloud provider web page if it has. minikube provides a storage class called standard by default, which is used by the helm chart by default.

Starting HStreamDB

Clone code and get helm dependencies

  1. git clone https://github.com/hstreamdb/hstream.git
  2. cd hstream/deploy/chart/hstream/
  3. helm dependency build .

Deploy HStreamDB by Helm

  1. helm install my-hstream .

Helm chart also provides the value.yaml file where you can modify your configuration, for example when you want to use other storage classes to deploy the cluster, you can modify logdevice.persistence.storageClass and zookeeper.persistence.storageClass in value.yaml, and use helm install my-hstream -f values.yaml . to deploy.

Check Cluster Status

The helm install command will deploy the zookeeper cluster, logdevice cluster and hstream cluster, this can take some time, you can check the status of the cluster with kubectl get pods, there will be some Error and CrashLoopBackOff status during the cluster deployment, these will disappear after some time, eventually you will see something like the following.

  1. NAME READY STATUS RESTARTS AGE
  2. my-hstream-0 1/1 Running 3 (16h ago) 16h
  3. my-hstream-1 1/1 Running 2 (16h ago) 16h
  4. my-hstream-2 1/1 Running 0 16h
  5. my-hstream-logdevice-0 1/1 Running 3 (16h ago) 16h
  6. my-hstream-logdevice-1 1/1 Running 3 (16h ago) 16h
  7. my-hstream-logdevice-2 1/1 Running 0 16h
  8. my-hstream-logdevice-3 1/1 Running 0 16h
  9. my-hstream-logdevice-admin-server-6867fd9494-bk5mf 1/1 Running 3 (16h ago) 16h
  10. my-hstream-zookeeper-0 1/1 Running 0 16h
  11. my-hstream-zookeeper-1 1/1 Running 0 16h
  12. my-hstream-zookeeper-2 1/1 Running 0 16h

You can check the status of the HStreamDB cluster with the hadmin server command.

  1. kubectl exec -it hstream-1 -- bash -c "hadmin server status"
  2. +---------+---------+------------------+
  3. | node_id | state | address |
  4. +---------+---------+------------------+
  5. | 100 | Running | 172.17.0.4:6570 |
  6. | 101 | Running | 172.17.0.10:6570 |
  7. | 102 | Running | 172.17.0.12:6570 |
  8. +---------+---------+------------------+

Manage HStore Cluster

Now you can run hadmin store to manage the hstore cluster:

  1. kubectl exec -it my-hstream-0 -- bash -c "hadmin store --help"

To check the state of the cluster, you can then run:

  1. kubectl exec -it my-hstream-0 -- bash -c "hadmin store --host my-hstream-logdevice-admin-server status"
  2. +----+------------------------+----------+-------+--------------+----------+
  3. | ID | NAME | PACKAGE | STATE | UPTIME | LOCATION |
  4. +----+------------------------+----------+-------+--------------+----------+
  5. | 0 | my-hstream-logdevice-0 | 99.99.99 | ALIVE | 16 hours ago | |
  6. | 1 | my-hstream-logdevice-1 | 99.99.99 | DEAD | 16 hours ago | |
  7. | 2 | my-hstream-logdevice-2 | 99.99.99 | DEAD | 16 hours ago | |
  8. | 3 | my-hstream-logdevice-3 | 99.99.99 | DEAD | 16 hours ago | |
  9. +----+------------------------+----------+-------+--------------+----------+
  10. +---------+-------------+---------------+------------+---------------+
  11. | SEQ. | DATA HEALTH | STORAGE STATE | SHARD OP. | HEALTH STATUS |
  12. +---------+-------------+---------------+------------+---------------+
  13. | ENABLED | HEALTHY(1) | READ_WRITE(1) | ENABLED(1) | HEALTHY |
  14. | ENABLED | HEALTHY(1) | READ_WRITE(1) | ENABLED(1) | HEALTHY |
  15. | ENABLED | HEALTHY(1) | READ_WRITE(1) | ENABLED(1) | HEALTHY |
  16. | ENABLED | HEALTHY(1) | READ_WRITE(1) | ENABLED(1) | HEALTHY |
  17. +---------+-------------+---------------+------------+---------------+
  18. Took 16.727s