Cheng Runke

Database r&d engineer, currently engaged in RadonDB MySQL Kubernetes research and development, keen on database kernel, K8s related technology.

Zhang Limei

Senior documentation engineer, currently responsible for database product documentation development, maintenance and management.

This article will demonstrate how to deploy RadonDB MySQL on Kubernetes 2.1.2 on KubeSphere[1] to quickly implement highly available MySQL on K8s.

preparedness

  • Ensure that the OpenPitrix system is enabled [2]
  • Create an enterprise space, a project, and a user for this operation [3]
  • During installation, use the adminIdentity login console in enterprise spacedemoIn thedemo-projectOperation in the project
  • Ensure that KubeSphere project gateway has enabled extranet access [4]

Hands-on LABS

1. Add an application repository

  1. Log in to KubeSphere’s Web console.
  2. indemoIn the enterprise space, go to the application repository page and click Add. The repository configuration dialog box is displayed.
  3. Enter the warehouse name and the warehouse URL.
    • The inputradondb-mysql-operatorAs the application repository name.
    • The inputhttps://radondb.github.io/radondb-mysql-kubernetes/As the URL of the warehouse, and click Verify to verify the URL, display a green check mark next to the URL, after verification, click OK to continue.
  4. After successfully importing the repository into KubeSphere, you can view the RadonDB MySQL repository in the list.

2. Deploy RadonDB MySQL Operator

  1. In the Demo-Project project, go to the application page under the application load and click Deploy new application.
  2. In the dialog box, select From Application Template. The Application Template page is displayed.
  3. Select radondb-mysql-operator application repository from the drop-down list.
  4. Click the mysql-operator application icon to view and configure the application information.

  1. On the configuration files TAB, you can view and edit the values.yaml configuration file. You can view and select the version number in the version column.

  1. Click Deploy. On the page for configuring basic information about the mysql-operator application, confirm the application name, application version, and deployment position.
  2. Click Next to go to the configuration page of the mysql-operator application. Confirm the values. Yaml configuration and modify the configuration by editing the file.

  1. Click Deploy to return to the application template page. When the application status changes to Running, the application is successfully deployed.

Update the Operator

If a historical version of Operator has been deployed in KubeSphere, you can use the following methods to update the Operator to the latest version.

  1. Delete the historical Operator application in KubeSphere platform.

  1. Refer to the previous steps to install Operator of the latest version.

  2. Run the following command to update the CRD version. The following example updates CRD to version 2.1.2.

kubectl apply -f https://raw.githubusercontent.com/radondb/radondb-mysql-kubernetes/v2.1.2/charts/mysql-operator/crds/mysql.radondb.com_m ysqlclusters.yamlCopy the code

3. Deploy RadonDB MySQL cluster

You can deploy either a RadonDB MySQL configuration example [5] or a custom configuration.

Create a RadonDB MySQL cluster using the mysql_v1alpha1_mysqlCluster. yaml template.

  1. Select the Kubectl tool from the toolbox in the lower right corner and open the terminal window.
  2. Run the following command to install the RadonDB MySQL cluster.
kubectl apply -f https://github.com/radondb/radondb-mysql-kubernetes/releases/latest/download/mysql_v1alpha1_mysqlcluster.yaml --namespace=<project_name>
Copy the code

Pay attention to

When no project is specified, the cluster will be installed in the Kubesphere – Controls-system project by default. To specify a project, add –namespace= to the installation command.

The expected results

$ kubectl apply -f https://github.com/radondb/radondb-mysql-kubernetes/releases/latest/download/mysql_v1alpha1_mysqlcluster.yaml --namespace=demo-project
mysqlcluster.mysql.radondb.com/sample created
Copy the code
  1. After the cluster is created, run the following command to view the RadonDB MySQL cluster node service.
kubectl get statefulset,svc
Copy the code

The expected results

$ kubectl get statefulset,svc NAME READY AGE statefulset.apps/sample-mysql 3/3 10m NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/ default-HTTP-backend ClusterIP 10.96.69.202 < None > 80/TCP 3H2m service/sample-follower ClusterIP 10.96.9.162 <none> 3306/TCP 10m service/sample-leader ClusterIP 10.96.255.188 < None > 3306/TCP 10m service/sample-mysql ClusterIP None <none> 3306/TCP 10mCopy the code

The deployment of check

In demo-project, check the RadonDB MySQL cluster status.

  1. You can view the cluster service information on the service page.

2. Enter theApplication of the loadUnder theThe workloadPage, clickSet of stateful replicasTo view the cluster status. To enter aSet of stateful replicasFor details, clickmonitoringTAB to view cluster indicators in a specified time range.

3. On the container group page, view the running status of cluster nodes.

4. On the Storage volume page, you can view the storage volume. View the usage of a storage volume. Using a data node as an example, you can view monitoring data such as the storage capacity and remaining capacity of the current storage.

At this point, the RadonDB MySQL cluster is deployed in KubeSphere.

Refer to the reference

[1] : kubesphere.com.cn

[2] : OpenPitrix: kubesphere. IO/useful/docs/plu…

[3] : create operation: kubesphere. IO/useful/docs/qui…

[4] : the gateway of the project: kubesphere. IO/useful/docs/pro…

[5] : Configuration example: github.com/radondb/rad…