New to KubeDB? Please start here.
Vertical Scale MaxScale Server
This guide will show you how to use KubeDB
Ops-manager operator to update the resources of a MaxScale server.
Before You Begin
At first, you need to have a Kubernetes cluster, and the
kubectl
command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using kind.Install
KubeDB
operator in your cluster following the steps here.You should be familiar with the following
KubeDB
concepts:
To keep everything isolated, we are going to use a separate namespace called demo
throughout this tutorial.
$ kubectl create ns demo
namespace/demo created
Apply Vertical Scaling on MaxScale Server
Here, we are going to deploy a MariaDB
cluster in replication mode using a supported version by KubeDB
operator. Then we will apply vertical scaling on MaxScale
server.
Deploy MariaDB Cluster
In this section, we are going to deploy a MariaDB database in replication mode. Then, in the next section we will update the resources of the MaxScale
server using MariaDBOpsRequest
CR. Below is the YAML of the MariaDB
CR that we are going to create,
apiVersion: kubedb.com/v1
kind: MariaDB
metadata:
name: md-replication
namespace: demo
spec:
version: "10.5.23"
replicas: 3
topology:
mode: MariaDBReplication
maxscale:
replicas: 3
enableUI: true
storageType: Durable
storage:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Mi
storageType: Durable
storage:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
deletionPolicy: WipeOut
Let’s create the MariaDB
CR we have shown above,
$ kubectl create -f https://github.com/kubedb/docs/raw/v2025.7.31/docs/examples/mariadb/scaling/md-replication.yaml
mariadb.kubedb.com/md-replication created
Now, wait until md-replication
has status Ready
. i.e,
$ kubectl get mariadb -n demo
NAME VERSION STATUS AGE
md-replication 10.5.23 Ready 2m39s
Let’s check the Pod containers resources,
$ kubectl get pod -n demo md-replication-mx-0 -o json | jq '.spec.containers[].resources'
{
"limits": {
"memory": "512Mi"
},
"requests": {
"cpu": "200m",
"memory": "256Mi"
}
}
You can see the Pod has the default resources which is assigned by KubeDB operator.
We are now ready to apply the MariaDBOpsRequest
CR to update the resources of this database.
Vertical Scaling
Here, we are going to update the resources of MaxScale
server to meet the desired resources after scaling.
Create MariaDBOpsRequest
In order to update the resources of the database, we have to create a MariaDBOpsRequest
CR with our desired resources. Below is the YAML of the MariaDBOpsRequest
CR that we are going to create,
apiVersion: ops.kubedb.com/v1alpha1
kind: MariaDBOpsRequest
metadata:
name: maxscale-vertical-scale
namespace: demo
spec:
type: VerticalScaling
databaseRef:
name: md-replication
verticalScaling:
maxscale:
resources:
requests:
memory: "512Mi"
cpu: "0.3"
limits:
memory: "1Gi"
cpu: "0.6"
Here,
spec.type
specifies that we are performingVerticalScaling
on our database.spec.databaseRef.name
specifies that we are performing vertical scaling operation onsample-mariadb
database.spec.VerticalScaling.maxscale
specifies the desired resources of maxscale server after scaling.
Let’s create the MariaDBOpsRequest
CR we have shown above,
$ kubectl apply -f https://github.com/kubedb/docs/raw/v2025.7.31/docs/examples/mariadb/scaling/vertical-scaling/mx-vscale.yaml
mariadbopsrequest.ops.kubedb.com/maxscale-vertical-scale created
Verify MaxScale server resources updated successfully
If everything goes well, KubeDB
Ops-manager operator will update the resources of MariaDB
object and related PetSets
and Pods
.
Let’s wait for MariaDBOpsRequest
to be Successful
. Run the following command to watch MariaDBOpsRequest
CR,
$ watch kubectl get mariadbopsrequest -n demo
Every 2.0s: kubectl get mariadbopsrequest -n demo
NAME TYPE STATUS AGE
maxscale-vertical-scale VerticalScaling Successful 3m8s
We can see from the above output that the MariaDBOpsRequest
has succeeded. Now, we are going to verify from one of the Pod yaml whether the resources of maxscale server has updated to meet up the desired state, Let’s check,
$ kubectl get pod -n demo md-replication-mx-0 -o json | jq '.spec.containers[].resources'
{
"limits": {
"cpu": "600m",
"memory": "1Gi"
},
"requests": {
"cpu": "300m",
"memory": "512Mi"
}
}
The above output verifies that we have successfully scaled up the resources of the MariaDB database.
Cleaning Up
To clean up the Kubernetes resources created by this tutorial, run:
$ kubectl delete mariadb -n demo md-replication
$ kubectl delete mariadbopsrequest -n demo maxscale-vertical-scale
$ kubectl delete ns demo