Note
What is AKS?
Azure Kubernetes Service is a managed Kubernetes service offered by the Microsoft Azure platform.
Prerequisites
In order for you to complete this tutorial you'll need:
An account on Microsoft Azure
The Azure CLI
kubectlto manage the Kubernetes clusterhelmto install SurrealDB and the data store operatorSurreal CLIto interact with the SurrealDB server
Note
Note
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.
Create a new resource group:
Run the following command to create a new AKS cluster:
After creation finishes, get credentials to configure
kubectlto connect to the new cluster:
You can verify the connection to the cluster with the following command:
Create cluster node pools
Note
Create a TiDB Operator and monitor pool:
Create a PD node pool:
Create a data store node pool:
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.
You can deploy it following these steps:
Install CRDS:
Install TiDB Operator Helm chart:
Verify that the pods are running:
Create TiDB cluster
Now that we have the TiDB Operator running, it's time to define a TiDB Cluster and let the Operator do the rest.
Create a local file named
tikv-cluster.yamlwith this content:
Create the TiDB cluster:
Check the cluster status and wait until it's ready:
Deploy SurrealDB
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 PD service URL:
Install the SurrealDB Helm chart with the TIKV_URL defined above and with auth disabled so we can create the initial credentials:
Wait until the Loadbalancer resource has an
EXTERNAL-IPassigned:
Connect to the cluster and define the initial credentials:
Verify you can connect to the database with the new credentials:
Now that the initial credentials have been created, enable authentication:
Cleanup
Run the following commands to delete the Kubernetes resources and the AKS cluster.