Provisioning the environment in your Azure account will create resources and there will be cost associated with them. The cleanup section provides a guide to remove them, preventing further charges.
Note
This guide was tested in westeurope region and it follows TiKV best practices for scalability and high availability.
This tutorial is intended for production workloads using the standard tier. If you want to create a dev/test environment, you should root for the free tier and change the cluster and node pool configuration (no zone, fewer nodes).
Create an AKS Cluster
Log in to Azure and get the current subscription if you have multiple subscriptions.
Log in and get subscription
$ az login $ az account list
Create a new resource group:
Create new group
$ az group create --name rg-surrealdb-aks --location westeurope
Run the following command to create a new AKS cluster:
Create new cluster
$ az aks create \ --resource-group rg-surrealdb-aks \ --location westeurope \ --name surrealdb-aks-cluster \ --generate-ssh-keys \ --load-balancer-sku standard \ --node-count 3 \ --zones 1 2 3 \ --enable-addons monitoring \ --tier standard
After creation finishes, get credentials to configure kubectl to connect to the new cluster:
Get AKS cluster credentials
$ az aks get-credentials --resource-group rg-surrealdb-aks --name surrealdb-aks-cluster
You can verify the connection to the cluster with the following command:
Display cluster nodes
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION aks-nodepool1-33674805-vmss000000 Ready agent 2m35s v1.26.6 aks-nodepool1-33674805-vmss000001 Ready agent 2m36s v1.26.6 aks-nodepool1-33674805-vmss000002 Ready agent 2m34s v1.26.6
Create cluster node pools
Note
In order to speed things up, the following commands can be executed in parallel.
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.
You can deploy it following these steps:
Now that we have a TiDB cluster running, we can deploy SurrealDB using the official Helm chart.
The deployment will use the latest SurrealDB Docker image and make it accessible on internet.
Get the TiKV PD service URL:
Get service URL
$ kubectl get service sdb-datastore-pd
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE sdb-datastore-pd ClusterIP 10.0.161.101 <none> 2379/TCP 5m27s
$ export TIKV_URL=tikv://sdb-datastore-pd:2379
Install the SurrealDB Helm chart with the TIKV_URL defined above and with auth disabled so we can create the initial credentials: