Kubernetes has, in the recent past, become the go to standard for building applications running multiple containers. Using Kubernetes comes with the need to run cloud-native distributed databases. One of the prominently emerging cloud-native, open-source NewSQL databases is TiDB.
By deploying TiDB on KubeSphere, this article demonstrates how you can have TiDB clusters powered by Kubernetes and how to manage the clusters using an easy to use web interface.
What is TiDB and KuberSphere?
TiDB, an open-source NewSQL database, supports Hybrid Transactional and Analytical Processing (HTAP) workloads. TiDB is MySQL compatible and contains features such as; horizontal scalability, a strong consistency, and is highly available. TiDB provides users with a single, multi-purpose database solution, covering systems and services such as;
Online Transactional Processing (OLTP)
Online Analytical Processing (OLAP), and
Hybrid transactional/analytical processing (HTAP)
KubeSphere, on the other hand, is a distributed operating system managing cloud native applications with Kubernetes as its kernel, and provides plug-and-play architecture for the seamless integration of third-party applications to boost its ecosystem.
How do you deploy TiDB on KubeSphere?
You will need a Kubernetes cluster before you deploy TiDB on KubeSphere. Installing the Kubernetes clusters require you to prepare either virtual or physical machines, and configuring network rules to enable smooth flow of traffic from one instance to the next.
How do you prepare the environments?
KubeSphere can be installed on any infrastructure, including deploying Kubernetes by itself. Read the KubeSphere documentation for more insights. In this article, we use the QingCloud platform, provided by QingCloud, which sponsors KubeSphere. It is a highly-functional platform that enables fast deployment of Kubernetes and KubeSphere at the same time with just a few clicks.
Deploying the TiDB Operator
The TiDB Operator is simply an automatic operation system used for TiDB clusters in Kubernetes. The operator provides a complete management life-cycle for TiDB, which includes deployment, scaling, upgrades, fail-over, backup, and any configuration changes. The TiDB Operator helps TiDB to run seamlessly in Kubernetes clusters that are deployed on public or private clouds. You should first deploy a TiDB Operator on KubeSphere, before you deploy a TiBD cluster.
Deploying a TiDB Cluster
So, after you have deployed the TiDB Operator, you can move ahead and deploy a TiDB cluster on Kubernetes. This process of deploying a TiDB cluster is pretty much similar to deploying the TiDB operator.
How do you Access TiDB Clusters?
Now that you have prepared your environment, deployed the TiDB operator and cluster, your apps are ready, and you may now need to focus on observability. The KubeSphere dashboard allows you to observe your applications throughout their lifecycle.
You then need to verify that the apps are up and running. Kubernetes lists all running services and the port in which each service is exposed to, for easy access.
Many developers continue to move from cloud-hosted to cloud native environments. As this happens, the way DevOps builds applications and stores distributed data continues to change. This article describes how TiDB and KubeSphere are powerful tools for cloud-native applications. As Suenot describes in his project, “How to use Rancher (Kubernetes cluster) on Hetzner cloud” it is not possible to showcase all the features of TiDB and KubeSphere in a single post.