Updates
By leveraging the automation provided by MariaDB Enterprise Operator, you can declaratively manage large fleets of databases using CRs. This also covers day two operations, such as upgrades, which can be risky when rolling out updates to thousands of instances simultaneously.
To mitigate this, and to give you full control on the upgrade process, you are able to choose between multiple update strategies described in the following sections.
Update strategies
In order to provide you with flexibility for updating MariaDB
reliably, this operator supports multiple update strategies:
ReplicasFirstPrimaryLast: Roll out replica
Pods
one by one, wait for each of them to become ready, and then proceed with the primaryPod
.RollingUpdate: Utilize the rolling update strategy from Kubernetes.
OnDelete: Updates are performed manually by deleting
Pods
.Never: Pause updates.
Configuration
The update strategy can be configured in the updateStrategy
field of the MariaDB
resource:
apiVersion: enterprise.mariadb.com/v1alpha1
kind: MariaDB
metadata:
name: mariadb
spec:
updateStrategy:
type: ReplicasFirstPrimaryLast
It defaults to ReplicasFirstPrimaryLast
if not provided.
Trigger updates
Updates are not limited to updating the image
field in the MariaDB
resource, an update will be triggered whenever any field of the Pod
template is changed. This translates into making changes to MariaDB
fields that map directly or indirectly to the Pod
template, for instance, the CPU and memory resources:
apiVersion: enterprise.mariadb.com/v1alpha1
kind: MariaDB
metadata:
name: mariadb
spec:
...
- image: docker.mariadb.com/enterprise-server:10.6.18-14.2
+ image: docker.mariadb.com/enterprise-server:10.6.19-15.1
resources:
requests:
cpu: 200m
memory: 128Mi
limits:
- memory: 1Gi
+ memory: 2Gi
Once the update is triggered, the operator manages it differently based on the selected update strategy.
ReplicasFirstPrimaryLast
ReplicasFirstPrimaryLast
This role-aware update strategy consists in rolling out the replica Pods
one by one first, waiting for each of them become ready (i.e. readiness probe passed), and then proceed with the primary Pod
. This is the default update strategy, as it can potentially meet various reliability requirements and minimize the risks associated with updates:
Write operations won't be affected until all the replica
Pods
have been rolled out. If something goes wrong in the update, such as an update to an incompatible MariaDB version, this is detected early when the replicas are being rolled out and the update operation will be paused at that point.Read operations impact is minimized by only rolling one replica
Pod
at a time.Waiting for every
Pod
to be synced minimizes the impact in the clustering protocols and the network.
RollingUpdate
RollingUpdate
This strategy leverages the rolling update strategy from the StatefulSet resource, which, unlike ReplicasFirstPrimaryLast, does not take into account the role of the Pods
(primary or replica). Instead, it rolls out the Pods
one by one, from the highest to the lowest StatefulSet
index.
You are able to pass extra parameters to this strategy via the rollingUpdate
object:
apiVersion: enterprise.mariadb.com/v1alpha1
kind: MariaDB
metadata:
name: mariadb
spec:
...
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
OnDelete
OnDelete
This strategy aims to provide a method to update MariaDB
resources manually by allowing the user to restart the Pods
individually. This way, the user has full control over the update process and can decide which Pods
are rolled out at any given time.
Whenever an update is triggered, the MariaDB
will be marked as pending to update:
kubectl get mariadbs
NAME READY STATUS PRIMARY UPDATES AGE
mariadb-galera True Pending update mariadb-galera-0 OnDelete 5m17s
From this point, you are able to delete the Pods
to trigger the update, which will result the MariaDB
marked as updating:
kubectl get mariadbs
NAME READY STATUS PRIMARY UPDATES AGE
mariadb-galera True Updating mariadb-galera-0 OnDelete 9m50s
Once all the Pods
have been rolled out, the MariaDB
resource will be back to a ready state:
NAME READY STATUS PRIMARY UPDATES AGE
mariadb-galera True Running mariadb-galera-0 OnDelete 12m
Never
Never
The operator will not perform updates on the StatefulSet
whenever this update strategy is configured. This could be useful in multiple scenarios:
Progressive fleet upgrades: If you're managing large fleets of databases, you likely prefer to roll out updates progressively rather than simultaneously across all instances.
Operator upgrades: When upgrading the operator, changes to the
StatefulSet
or thePod
template may occur from one version to another, which could trigger a rolling update of yourMariaDB
instances.
Data-plane updates
Galera relies on data-plane containers that run alongside MariaDB to implement provisioning and high availability operations on the cluster. These containers use the mariadb-enterprise-operator
image, which can be automatically updated by the operator based on its image version:
apiVersion: enterprise.mariadb.com/v1alpha1
kind: MariaDB
metadata:
name: mariadb-galera
spec:
updateStrategy:
autoUpdateDataPlane: true
By default, updateStrategy.autoUpdateDataPlane
is false
, which means that no automatic upgrades will be performed, but you can opt-in/opt-out from this feature at any point in time by updating this field. For instance, you may want to selectively enable updateStrategy.autoUpdateDataPlane
in a subset of your MariaDB
instances after the operator has been upgraded to a newer version, and then disable it once the upgrades are completed.
It is important to note that this feature is fully compatible with the Never strategy: no upgrades will happen when updateStrategy.autoUpdateDataPlane=true
and updateStrategy.type=Never
.
This page is: Copyright © 2025 MariaDB. All rights reserved.
Last updated
Was this helpful?