Overview
KubeDB is the Kubernetes Native Database Management Solution which simplifies and automates routine database tasks such as Provisioning, Monitoring, Upgrading, Patching, Scaling, Volume Expansion, Backup, Recovery, Failure detection, and Repair for various popular databases on private and public clouds. The databases supported by KubeDB include MongoDB, Elasticsearch, MySQL, MariaDB, Redis, PostgreSQL, FerretDB, SingleStore, Percona XtraDB, and Memcached. Additionally, KubeDB also supports ProxySQL, PgBouncer, Pgpool, ZooKeeper and the streaming platform Kafka, RabbitMQ. You can find the guides to all the supported databases in KubeDB . In this tutorial we will deploy SingleStore in Amazon Elastic Kubernetes Service (Amazon EKS). We will cover the following steps:
- Install KubeDB
- Deploy SingleStore Cluster
- Read/Write Sample Data
- Access SingleStore Studio UI
Get Cluster ID
We need the cluster ID to get the KubeDB License. To get cluster ID, we can run the following command:
$ kubectl get ns kube-system -o jsonpath='{.metadata.uid}'
8e336615-0dbb-4ae8-b72f-2e7ec34c399d
Get License
Go to Appscode License Server to get the license.txt file. For this tutorial we will use KubeDB.
Install KubeDB
We will use helm to install KubeDB. Please install helm here
if it is not already installed.
Now, let’s install KubeDB
.
$ helm search repo appscode/kubedb
NAME CHART VERSION APP VERSION DESCRIPTION
appscode/kubedb v2024.8.21 v2024.8.21 KubeDB by AppsCode - Production ready databases...
appscode/kubedb-autoscaler v0.32.0 v0.32.0 KubeDB Autoscaler by AppsCode - Autoscale KubeD...
appscode/kubedb-catalog v2024.8.21 v2024.8.21 KubeDB Catalog by AppsCode - Catalog for databa...
appscode/kubedb-community v0.24.2 v0.24.2 KubeDB Community by AppsCode - Community featur...
appscode/kubedb-crd-manager v0.2.0 v0.2.0 KubeDB CRD Manager by AppsCode
appscode/kubedb-crds v2024.8.21 v2024.8.21 KubeDB Custom Resource Definitions
appscode/kubedb-dashboard v0.23.0 v0.23.0 KubeDB Dashboard by AppsCode
appscode/kubedb-enterprise v0.11.2 v0.11.2 KubeDB Enterprise by AppsCode - Enterprise feat...
appscode/kubedb-grafana-dashboards v2024.8.21 v2024.8.21 A Helm chart for kubedb-grafana-dashboards by A...
appscode/kubedb-kubestash-catalog v2024.8.21 v2024.8.21 KubeStash Catalog by AppsCode - Catalog of Kube...
appscode/kubedb-metrics v2024.8.21 v2024.8.21 KubeDB State Metrics
appscode/kubedb-one v2023.12.28 v2023.12.28 KubeDB and Stash by AppsCode - Production ready...
appscode/kubedb-ops-manager v0.34.0 v0.34.1 KubeDB Ops Manager by AppsCode - Enterprise fea...
appscode/kubedb-opscenter v2024.8.21 v2024.8.21 KubeDB Opscenter by AppsCode
appscode/kubedb-provider-aws v2024.8.21 v0.9.0 A Helm chart for KubeDB AWS Provider for Crossp...
appscode/kubedb-provider-azure v2024.8.21 v0.9.0 A Helm chart for KubeDB Azure Provider for Cros...
appscode/kubedb-provider-gcp v2024.8.21 v0.9.0 A Helm chart for KubeDB GCP Provider for Crossp...
appscode/kubedb-provisioner v0.47.0 v0.47.1 KubeDB Provisioner by AppsCode - Community feat...
appscode/kubedb-schema-manager v0.23.0 v0.23.0 KubeDB Schema Manager by AppsCode
appscode/kubedb-ui v2024.8.21 0.7.6 A Helm chart for Kubernetes
appscode/kubedb-ui-presets v2024.8.21 v2024.8.21 KubeDB UI Presets
appscode/kubedb-ui-server v2021.12.21 v2021.12.21 A Helm chart for kubedb-ui-server by AppsCode
appscode/kubedb-webhook-server v0.23.0 v0.23.1 KubeDB Webhook Server by AppsCode
$ helm install kubedb oci://ghcr.io/appscode-charts/kubedb \
--version v2024.8.21 \
--namespace kubedb --create-namespace \
--set-file global.license=/path/to/the/license.txt \
--set global.featureGates.Singlestore=true \
--wait --burst-limit=10000 --debug
Let’s verify the installation:
$ kubectl get pods --all-namespaces -l "app.kubernetes.io/instance=kubedb"
NAMESPACE NAME READY STATUS RESTARTS AGE
kubedb kubedb-kubedb-autoscaler-6b6c89848b-6tgpp 1/1 Running 0 2m44s
kubedb kubedb-kubedb-ops-manager-85cc5b5cd6-khkqq 1/1 Running 0 2m44s
kubedb kubedb-kubedb-provisioner-5d9c45448-qqzhd 1/1 Running 0 2m44s
kubedb kubedb-kubedb-webhook-server-c765df5d6-9bmwp 1/1 Running 0 2m44s
kubedb kubedb-petset-operator-77b6b9897f-bfnlw 1/1 Running 0 2m44s
kubedb kubedb-petset-webhook-server-6d8bc5565d-xsvwp 2/2 Running 0 2m44s
kubedb kubedb-sidekick-c898cff4c-zlwxn 1/1 Running 0 2m44s
We can list the CRD Groups that have been registered by the operator by running the following command:
$ kubectl get crd -l app.kubernetes.io/name=kubedb
NAME CREATED AT
clickhouseversions.catalog.kubedb.com 2024-09-23T10:28:05Z
connectclusters.kafka.kubedb.com 2024-09-23T10:28:47Z
connectors.kafka.kubedb.com 2024-09-23T10:28:47Z
druidversions.catalog.kubedb.com 2024-09-23T10:28:05Z
elasticsearchautoscalers.autoscaling.kubedb.com 2024-09-23T10:28:43Z
elasticsearchdashboards.elasticsearch.kubedb.com 2024-09-23T10:28:44Z
elasticsearches.kubedb.com 2024-09-23T10:28:43Z
elasticsearchopsrequests.ops.kubedb.com 2024-09-23T10:28:43Z
elasticsearchversions.catalog.kubedb.com 2024-09-23T10:28:05Z
etcdversions.catalog.kubedb.com 2024-09-23T10:28:05Z
ferretdbversions.catalog.kubedb.com 2024-09-23T10:28:05Z
kafkaautoscalers.autoscaling.kubedb.com 2024-09-23T10:28:47Z
kafkaconnectorversions.catalog.kubedb.com 2024-09-23T10:28:05Z
kafkaopsrequests.ops.kubedb.com 2024-09-23T10:28:47Z
kafkas.kubedb.com 2024-09-23T10:28:47Z
kafkaversions.catalog.kubedb.com 2024-09-23T10:28:05Z
mariadbarchivers.archiver.kubedb.com 2024-09-23T10:28:51Z
mariadbautoscalers.autoscaling.kubedb.com 2024-09-23T10:28:50Z
mariadbdatabases.schema.kubedb.com 2024-09-23T10:28:50Z
mariadbopsrequests.ops.kubedb.com 2024-09-23T10:28:50Z
mariadbs.kubedb.com 2024-09-23T10:28:50Z
mariadbversions.catalog.kubedb.com 2024-09-23T10:28:05Z
memcachedversions.catalog.kubedb.com 2024-09-23T10:28:05Z
mongodbarchivers.archiver.kubedb.com 2024-09-23T10:28:54Z
mongodbautoscalers.autoscaling.kubedb.com 2024-09-23T10:28:54Z
mongodbdatabases.schema.kubedb.com 2024-09-23T10:28:54Z
mongodbopsrequests.ops.kubedb.com 2024-09-23T10:28:54Z
mongodbs.kubedb.com 2024-09-23T10:28:54Z
mongodbversions.catalog.kubedb.com 2024-09-23T10:28:05Z
mssqlserverversions.catalog.kubedb.com 2024-09-23T10:28:06Z
mysqlarchivers.archiver.kubedb.com 2024-09-23T10:28:58Z
mysqlautoscalers.autoscaling.kubedb.com 2024-09-23T10:28:58Z
mysqldatabases.schema.kubedb.com 2024-09-23T10:28:58Z
mysqlopsrequests.ops.kubedb.com 2024-09-23T10:28:58Z
mysqls.kubedb.com 2024-09-23T10:28:58Z
mysqlversions.catalog.kubedb.com 2024-09-23T10:28:06Z
perconaxtradbversions.catalog.kubedb.com 2024-09-23T10:28:06Z
pgbouncerversions.catalog.kubedb.com 2024-09-23T10:28:06Z
pgpoolversions.catalog.kubedb.com 2024-09-23T10:28:06Z
postgresarchivers.archiver.kubedb.com 2024-09-23T10:29:01Z
postgresautoscalers.autoscaling.kubedb.com 2024-09-23T10:29:01Z
postgresdatabases.schema.kubedb.com 2024-09-23T10:29:02Z
postgreses.kubedb.com 2024-09-23T10:29:01Z
postgresopsrequests.ops.kubedb.com 2024-09-23T10:29:01Z
postgresversions.catalog.kubedb.com 2024-09-23T10:28:06Z
proxysqlversions.catalog.kubedb.com 2024-09-23T10:28:06Z
publishers.postgres.kubedb.com 2024-09-23T10:29:02Z
rabbitmqversions.catalog.kubedb.com 2024-09-23T10:28:06Z
redisautoscalers.autoscaling.kubedb.com 2024-09-23T10:29:05Z
redises.kubedb.com 2024-09-23T10:29:05Z
redisopsrequests.ops.kubedb.com 2024-09-23T10:29:05Z
redissentinelautoscalers.autoscaling.kubedb.com 2024-09-23T10:29:05Z
redissentinelopsrequests.ops.kubedb.com 2024-09-23T10:29:05Z
redissentinels.kubedb.com 2024-09-23T10:29:05Z
redisversions.catalog.kubedb.com 2024-09-23T10:28:06Z
restproxies.kafka.kubedb.com 2024-09-23T10:28:47Z
schemaregistries.kafka.kubedb.com 2024-09-23T10:28:47Z
schemaregistryversions.catalog.kubedb.com 2024-09-23T10:28:06Z
singlestoreautoscalers.autoscaling.kubedb.com 2024-09-23T10:29:08Z
singlestoreopsrequests.ops.kubedb.com 2024-09-23T10:29:08Z
singlestores.kubedb.com 2024-09-23T10:29:08Z
singlestoreversions.catalog.kubedb.com 2024-09-23T10:28:06Z
solrversions.catalog.kubedb.com 2024-09-23T10:28:06Z
subscribers.postgres.kubedb.com 2024-09-23T10:29:02Z
zookeeperversions.catalog.kubedb.com 2024-09-23T10:28:06Z
Create SingleStore License Secret
First, we need to create a namespace for our SingleStore deployment. Open your terminal and run the following command:
$ kubectl create namespace demo
namespace/demo created
Next, you’ll need a SingleStore license
to create the SingleStore database. Ensure that you have acquired a license, then create a secret to store your license information. Run the following command, replacing your-license-here
with your actual license key:
$ kubectl create secret generic -n demo license-secret \
--from-literal=username=license \
--from-literal=password='your-license-here'
With the namespace and license secret created, we can now deploy the SingleStore cluster.
Deploy SingleStore Cluster
Here is the yaml of the SingleStore CR we are going to use:
apiVersion: kubedb.com/v1alpha2
kind: Singlestore
metadata:
name: singlestore-cluster
namespace: demo
spec:
version: "8.5.7"
topology:
aggregator:
replicas: 2
podTemplate:
spec:
containers:
- name: singlestore
resources:
limits:
memory: "2Gi"
cpu: "600m"
requests:
memory: "2Gi"
cpu: "600m"
storage:
storageClassName: "gp2"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
leaf:
replicas: 3
podTemplate:
spec:
containers:
- name: singlestore
resources:
limits:
memory: "2Gi"
cpu: "600m"
requests:
memory: "2Gi"
cpu: "600m"
storage:
storageClassName: "gp2"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
licenseSecret:
name: license-secret
storageType: Durable
deletionPolicy: WipeOut
Let’s save this yaml configuration into singlestore-cluster.yaml
Then create the above SingleStore CR,
$ kubectl apply -f singlestore-cluster.yaml
singlestore.kubedb.com/singlestore-cluster created
In this yaml,
- In this yaml we can see in the
spec.version
field specifies the version of SingleStore. Here, we are using SingleStore8.5.7
. You can list the KubeDB supported versions of SingleStore by running$ kubectl get singlestoreversions
command. spec.topology
represents the clustering configuration for SingleStore.spec.topology.aggregator.replicas
orspec.topology.leaf.replicas
specifies that the number replicas that will be used for aggregator or leaf.spec.storageType
specifies the type of storage that will be used for SingleStore database. It can beDurable
orEphemeral
.spec.storage.storageClassName
is the name of the StorageClass used to provision PVCs.
Once these are handled correctly and the SingleStore cluster is deployed, you will see that the following objects are created:
$ kubectl get all -n demo
NAME READY STATUS RESTARTS AGE
pod/singlestore-cluster-aggregator-0 2/2 Running 0 4m38s
pod/singlestore-cluster-aggregator-1 2/2 Running 0 86s
pod/singlestore-cluster-leaf-0 2/2 Running 0 4m35s
pod/singlestore-cluster-leaf-1 2/2 Running 0 85s
pod/singlestore-cluster-leaf-2 2/2 Running 0 78s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/singlestore-cluster ClusterIP 10.96.132.208 <none> 3306/TCP,8081/TCP 4m41s
service/singlestore-cluster-pods ClusterIP None <none> 3306/TCP 4m41s
NAME TYPE VERSION AGE
appbinding.appcatalog.appscode.com/singlestore-cluster kubedb.com/singlestore 8.5.7 32s
NAME TYPE VERSION STATUS AGE
singlestore.kubedb.com/singlestore-cluster kubedb.com/v1alpha2 8.5.7 Ready 4m41s
Let’s check if the database is ready to use,
$ kubectl get singlestore -n demo singlestore-cluster
NAME TYPE VERSION STATUS AGE
singlestore-cluster kubedb.com/v1alpha2 8.5.7 Ready 5m14s
We have successfully deployed SingleStore cluster in Amazon EKS.
Accessing Database Through CLI
To access the database through CLI, we have to get the credentials to access. KubeDB will create Secret and Service for the database singlestore-cluster
that we have deployed. Let’s check them using the following commands,
$ kubectl get secret -n demo -l=app.kubernetes.io/instance=singlestore-cluster
NAME TYPE DATA AGE
singlestore-cluster-root-cred kubernetes.io/basic-auth 2 5m56s
$ kubectl get service -n demo -l=app.kubernetes.io/instance=singlestore-cluster
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
singlestore-cluster ClusterIP 10.96.132.208 <none> 3306/TCP,8081/TCP 6m9s
singlestore-cluster-pods ClusterIP None <none> 3306/TCP 6m9s
Now, we are going to use singlestore-cluster-root-cred
to get the credentials.
$ kubectl get secrets -n demo singlestore-cluster-root-cred -o jsonpath='{.data.username}' | base64 -d
root
$ kubectl get secrets -n demo singlestore-cluster-root-cred -o jsonpath='{.data.password}' | base64 -d
YZ1vVcZp~6Ui2(.s
Insert Sample Data
In this section, we are going to login into our SingleStore database pod and insert some sample data.
$ kubectl exec -it singlestore-cluster-aggregator-0 -n demo -- bash
Defaulted container "singlestore" out of: singlestore, singlestore-coordinator, singlestore-init (init)
[memsql@singlestore-cluster-aggregator-0 /]$ memsql -uroot -p"YZ1vVcZp~6Ui2(.s"
Server version: 5.7.32 SingleStoreDB source distribution (compatible; MySQL Enterprise & MySQL Commercial)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
singlestore> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| cluster |
| information_schema |
| memsql |
| singlestore_health |
+--------------------+
4 rows in set (0.00 sec)
singlestore> CREATE DATABASE Music PARTITIONS 2;
Query OK, 1 row affected (2.54 sec)
singlestore> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| Music |
| cluster |
| information_schema |
| memsql |
| singlestore_health |
+--------------------+
5 rows in set (0.01 sec)
singlestore> CREATE TABLE Music.Artist (id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, Name VARCHAR(50), Song VARCHAR(50));
Query OK, 0 rows affected, 1 warning (0.13 sec)
singlestore> INSERT INTO Music.Artist (Name, Song) VALUES ("Bobby Bare", "Five Hundred Miles");
Query OK, 1 row affected (1.13 sec)
singlestore> SELECT * FROM Music.Artist;
+----+------------+--------------------+
| id | Name | Song |
+----+------------+--------------------+
| 1 | Bobby Bare | Five Hundred Miles |
+----+------------+--------------------+
1 row in set (0.10 sec)
singlestore> exit
Bye
We’ve successfully inserted some sample data to our database. More information about Deploy & Manage SingleStore on Kubernetes can be found in Kubernetes SingleStore
Accessing SingleStore Studio UI
Now, we will access the SingleStore Studio UI using port forwarding , which will allow you to manage your SingleStore cluster via a web interface. Run the following command in your terminal, you should see output indicating that port forwarding is active:
$ kubectl port-forward -n demo service/singlestore-cluster 8081
Forwarding from 127.0.0.1:8081 -> 8081
Forwarding from [::1]:8081 -> 8081
Now, the SingleStore Studio UI is accessible at localhost:8081
. Open your web browser and navigate to localhost:8081
. You will see the SingleStore Studio login panel. Choose the Add Existing Cluster
option and click the Next
button.
Next, enter your cluster information, then click the Submit
button.
Once you have provided all the valid information, you will gain access to the SingleStore Studio.
Congratulations! You have successfully accessed the SingleStore Studio. This interface provides a convenient way to monitor and administer your SingleStore database.
We have made a in depth tutorial on Effortlessly Deploy and Manage SingleStore on Kubernetes using KubeDB. You can have a look into the video below:
Support
To speak with us, please leave a message on our website .
To receive product announcements, follow us on X .
To watch tutorials of various Production-Grade Kubernetes Tools Subscribe our YouTube channel.
More about SingleStore on Kubernetes
If you have found a bug with KubeDB or want to request for new features, please file an issue .