How to set up a SurrealDB cluster backed by TiKV on Google Kubernetes Engine.
This article will guide you through the process of setting up a highly available SurrealDB cluster backed by TiKV on a GKE Autopilot cluster.
What is GKE?
Google Kubernetes Engine is a managed Kubernetes service offered by Google Cloud Platform. In this guide we will create a GKE Autopilot cluster, which removes the need to manage the underlying compute nodes.
What is TiKV?
TiKV is a cloud-native transactional key/value store built by PingCAP and that integrates well with Kubernetes thanks to their TiDB operator.
Prerequisites
In order for you to complete this tutorial you'll need:
kubectl with gcloud integration for accessing the GKE cluster. Installation here
helm : To install SurrealDB server and TiKV
Surreal CLI : To interact with the SurrealDB server
Create GKE cluster
Choose the target project and region. List them with these commands:
List projects and regions
gcloud projects list
gcloud compute regions list --project PROJECT_ID
Run the following command to create a cluster replacing the REGION and PROJECT_ID for your desired values:
Create new GKE autopilot Cluster
gcloud container clusters create-auto surrealdb-guide --region REGION --project PROJECT_ID
After the creation finishes, configure kubectl to connect to the new cluster:
kubectl configuration
gcloud container clusters get-credentials surrealdb-guide --region REGION --project PROJECT_ID
Deploy TiDB operator
Now that we have a Kubernetes cluster, we can deploy the TiDB operator. TiDB operator is a Kubernetes operator that manages the lifecycle of TiDB clusters deployed to Kubernetes.