surrealdb / docker.surrealdb.com

Configuration files for running a multi-node SurrealDB cluster using Docker
https://docker.surrealdb.com
Apache License 2.0
36 stars 5 forks source link

Kubernetes support #1

Closed mysticaltech closed 1 year ago

mysticaltech commented 1 year ago

Hello, maybe this is out of scope here, but having used ArangoDB before, they have an excellent Kubernetes operator to deploy DB instances quickly.

I could transform the docker-compose.yml file automatically to make it run on Kubernetes, but having an actual operator managing the DB on Kubernetes is another level of coolness.

Keep up the excellent work!

4F2E4A2E commented 1 year ago

I want to help building one. The only missing part for me is how to Bild a surrealdb cluster with tikv. tikv has its own k8s operator and I haven't figured out yet how to bring those together as one operator, without reinventing the wheel ...

mysticaltech commented 1 year ago

@4F2E4A2E Seems easy enough have studied the problem and confirmed the following.

Use the TiDB Operator with a count of 0 for TiDB instances. This is confirmed to work. So what will be left are the TiKV instances.

Now you use those along a deployment of SurrealDB based to the docker compose, that you can automatically translate to Kube too.

If you make progress on this, please share a repo 🙏

4F2E4A2E commented 1 year ago

@mysticaltech Thank you for the sparing. I think to have a better understanding now. Can you &/ someone else, please help me out, providing feedback on the architecture? This is how I understand it, is this accurate?

surrealdb_architecture

In this diagram, the client sends an SQL query to TiDB, which then retrieves metadata about the query from PD (the Placement Driver). TiDB then sends a request to TiKV to retrieve the relevant data, with the addition of a step where TiDB sends the retrieved data to SurrealDB for analysis.

Once SurrealDB has analyzed the data, it sends the analyzed data back to TiDB, which then returns the results to the client.

26tanishabanik commented 1 year ago

@4F2E4A2E , @mysticaltech , I would also like to contribute to this issue. I have experience in writing controllers in golang and rust

mysticaltech commented 1 year ago

@4F2E4A2E TiDB is not involved. Basically just TiKV.

@26tanishabanik I now believe that creating an operator would be overkill. I think just a deployment with the right config for the TiDB operator would be enough. But if you see ways to automate things, then why not! Am sure the owners of the repo would consider a PR that adds useful Kubernetes logic.

sgirones commented 1 year ago

we recently published a Kubernetes Deployment guide https://surrealdb.com/docs/deployment/kubernetes

Let us know what you think!

mysticaltech commented 1 year ago

Looks straightforward, thanks @sgirones! One possible improvement is to deploy the tikv cluster by completely omitting the .spec.tidb part in its helm values file, that way it just deploys a pure tikv cluster. See https://github.com/pingcap/tidb-operator/issues/4826#issuecomment-1439754045