cluster.meta

Issues/PRs archive for MTRNord/cluster
git clone git://archive.git.mtrnord.blog/MTRNord/cluster.meta.git
Log | Files | Refs

36.md (35141B)


      1 # PR #36 chore(deps): update helm release mariadb-operator to v25
      2 
      3 - **Status:** merged
      4 - **Author:** @renovate[bot]
      5 - **Created:** 2025-12-07T21:21:38Z
      6 - **Branch:** renovate/mariadb-operator-25.x → main
      7 - **Merged:** 2025-12-07T21:26:17Z
      8 - **Labels:** type/major-update
      9 - **Diff:** [36.diff](./36.diff)
     10 
     11 ---
     12 
     13 This PR contains the following updates:
     14 
     15 | Package | Update | Change |
     16 |---|---|---|
     17 | [mariadb-operator](https://redirect.github.com/mariadb-operator/mariadb-operator) | major | `0.38.1` -> `25.10.2` |
     18 
     19 ---
     20 
     21 ### Release Notes
     22 
     23 <details>
     24 <summary>mariadb-operator/mariadb-operator (mariadb-operator)</summary>
     25 
     26 ### [`v25.10.2`](https://redirect.github.com/mariadb-operator/mariadb-operator/releases/tag/25.10.2)
     27 
     28 [Compare Source](https://redirect.github.com/mariadb-operator/mariadb-operator/compare/mariadb-operator-25.10.1...mariadb-operator-25.10.2)
     29 
     30 **`mariadb-operator` [25.10.2](https://redirect.github.com/mariadb-operator/mariadb-operator/releases/tag/25.10.2) is here!** 🦭
     31 
     32 We are thrilled to announce that our **highly available, replication-based topology is now generally available!** 🎉  It is been quite a journey and we are very excited about this milestone. A huge thank-you to everyone involved, specially for those who actively contributed to the development of this feature, namely [@&#8203;hedgieinsocks](https://redirect.github.com/hedgieinsocks) and [@&#8203;Michaelpalacce](https://redirect.github.com/Michaelpalacce)! 🙇🏼 Please refer to the **[Pull Request for additional details](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1441)** about all the changes introduced in this release.
     33 
     34 If you're upgrading from previous versions, **do not miss the [UPGRADE GUIDE](https://redirect.github.com/mariadb-operator/mariadb-operator/blob/main/docs/releases/UPGRADE_25.10.0.md)** for a smooth transition.
     35 
     36 #### Provisioning a replication cluster
     37 
     38 In order to provision a replication cluster, you need to configure a number of `replicas` greater than `1` and set the `replication.enabled=true` in the `MariaDB` CR:
     39 
     40 ```yaml
     41 apiVersion: k8s.mariadb.com/v1alpha1
     42 kind: MariaDB
     43 metadata:
     44   name: mariadb-repl
     45 spec:
     46   replicas: 3
     47   replication:
     48     enabled: true
     49 ```
     50 
     51 After applying the previous CR, the operator will provision a replication cluster with one primary and two replicas. The operator will take care of setting up replication, configuring the replication user and monitoring the replication status:
     52 
     53 ```bash
     54 kubectl get pods
     55 NAME                                    READY   STATUS    RESTARTS   AGE
     56 mariadb-repl-0                          2/2     Running   0          2d19h
     57 mariadb-repl-1                          2/2     Running   0          2d19h
     58 mariadb-repl-2                          2/2     Running   0          2d19h
     59 mariadb-repl-metrics-56865fff65-t72kc   1/1     Running   0          2d20h
     60 
     61 kubectl get mariadb
     62 NAME           READY   STATUS    PRIMARY          UPDATES                    AGE
     63 mariadb-repl   True    Running   mariadb-repl-0   ReplicasFirstPrimaryLast   2d20h
     64 ```
     65 
     66 As you can see, the primary can be identified in the `PRIMARY` column of the `kubectl get mariadb` output. You may also inspect the current replication status by checking the `MariaDB` status.
     67 
     68 #### Primary failover
     69 
     70 Whenever the primary `Pod` goes down, the operator will automatically trigger a failover to the furthest advanced replica. This is the default behaviour, and can be configured by setting:
     71 
     72 ```yaml
     73 apiVersion: k8s.mariadb.com/v1alpha1
     74 kind: MariaDB
     75 metadata:
     76   name: mariadb-repl
     77 spec:
     78   replicas: 3
     79   replication:
     80     enabled: true
     81     primary:
     82       autoFailover: true
     83       autoFailoverDelay: 0s
     84 ```
     85 
     86 In this situation, the following status will be reported in the `MariaDB` CR:
     87 
     88 ```bash
     89 kubectl get mariadb
     90 NAME           READY   STATUS                                  PRIMARY          UPDATES                    AGE
     91 mariadb-repl   False   Switching primary to 'mariadb-repl-1'   mariadb-repl-0   ReplicasFirstPrimaryLast   3d2h 
     92 
     93 kubectl get mariadb
     94 NAME           READY   STATUS    PRIMARY          UPDATES                    AGE
     95 mariadb-repl   True    Running   mariadb-repl-1   ReplicasFirstPrimaryLast   3d2h
     96 ```
     97 
     98 #### Scaling out
     99 
    100 The operator will scale horizontaly the replication cluster whenever you increase the number of `spec.replicas`. Before doing so, you should specify a template `PhysicalBackup` resource that the operator will use to create the actual `PhysicalBackup` objects to set up new replicas during scaling out events:
    101 
    102 ```yaml
    103 apiVersion: k8s.mariadb.com/v1alpha1
    104 kind: MariaDB
    105 metadata:
    106   name: mariadb-repl
    107 spec:
    108   replication:
    109     enabled: true
    110     replica:
    111       bootstrapFrom:
    112         physicalBackupTemplateRef:
    113           name: physicalbackup-tpl
    114 ---
    115 apiVersion: k8s.mariadb.com/v1alpha1
    116 kind: PhysicalBackup
    117 metadata:
    118   name: physicalbackup-tpl
    119 spec:
    120   mariaDbRef:
    121     name: mariadb-repl
    122   schedule:
    123     suspend: true
    124   storage:
    125     volumeSnapshot:
    126       volumeSnapshotClassName: csi-hostpath-snapclass
    127 ```
    128 
    129 After configuring this, you will be able to scale the cluster simply by:
    130 
    131 ```bash
    132 kubectl scale mariadb mariadb-repl --replicas=4
    133 
    134 kubectl get mariadb
    135 NAME           READY   STATUS        PRIMARY          UPDATES                    AGE
    136 mariadb-repl   False   Scaling out   mariadb-repl-1   ReplicasFirstPrimaryLast   3d5h
    137 
    138 kubectl get pods
    139 NAME                                    READY   STATUS    RESTARTS   AGE
    140 mariadb-repl-0                          2/2     Running   0          137m
    141 mariadb-repl-1                          2/2     Running   0          3d5h
    142 mariadb-repl-2                          2/2     Running   0          3d5h
    143 mariadb-repl-3                          2/2     Running   0          40s
    144 ```
    145 
    146 #### Replica recovery
    147 
    148 The operator has the ability to automatically recover replicas that become unavailable and report a specific error code in the replication status.  For doing so, the operator continiously monitors the replication status of each replica, and whenever they report a known error code, a recovery operation will be triggered.
    149 
    150 Similarly to the scaling out operation, you need to define a `PhysicalBackup` template and set a reference to it in the `spec.replication.replica.bootstrapFrom` field of the `MariaDB` CR. Additionally, you need to explicitly enable the replica recovery, as it is disabled by default:
    151 
    152 ```yaml
    153 apiVersion: k8s.mariadb.com/v1alpha1
    154 kind: MariaDB
    155 metadata:
    156   name: mariadb-repl
    157 spec:
    158   replication:
    159     enabled: true
    160     replica:
    161       bootstrapFrom:
    162         physicalBackupTemplateRef:
    163           name: physicalbackup-tpl
    164       recovery:
    165         enabled: true
    166         errorDurationThreshold: 5m
    167 ```
    168 
    169 We will be simulating a [`1236` error](https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1200-to-1299/e1236) in a replica to demostrate how the recovery process works:
    170 
    171 > \[!CAUTION]
    172 > Do not perform the following steps in a production environment.
    173 
    174 - Purge the binary logs in the primary:
    175 
    176 ```bash
    177 PRIMARY=$(kubectl get mariadb mariadb-repl -o jsonpath="{.status.currentPrimary}")
    178 echo "Purging binary logs in primary $PRIMARY"
    179 kubectl exec -it $PRIMARY -c mariadb -- mariadb -u root -p'MariaDB11!' --ssl=false -e "FLUSH LOGS;"
    180 kubectl exec -it $PRIMARY -c mariadb -- mariadb -u root -p'MariaDB11!' --ssl=false -e "PURGE BINARY LOGS BEFORE NOW();"
    181 kubectl exec -it $PRIMARY -c mariadb -- mariadb -u root -p'MariaDB11!' --ssl=false -e "SHOW BINARY LOGS;"
    182 ```
    183 
    184 - Delete the PVC and restart one of the replicas:
    185 
    186 ```bash
    187 REPLICA=$(kubectl get mariadb mariadb-repl -o jsonpath='{.status.replication.replicas}' | jq -r 'keys[]' | head -n1)
    188 echo "Deleting PVC and restarting replica $REPLICA"
    189 kubectl delete pvc storage-$REPLICA --wait=false 
    190 kubectl delete pod $REPLICA --wait=false 
    191 ```
    192 
    193 This will trigger a replica recovery operation:
    194 
    195 ```bash
    196 kubectl get mariadb
    197 NAME           READY   STATUS                PRIMARY          UPDATES                    AGE
    198 mariadb-repl   False   Recovering replicas   mariadb-repl-1   ReplicasFirstPrimaryLast   3d6h
    199 
    200 kubectl get pods
    201 NAME                                                              READY   STATUS            RESTARTS       AGE
    202 mariadb-repl-0                                                    0/2     PodInitializing   0              22s
    203 mariadb-repl-0-physicalbackup-init-qn79f                          0/1     Completed         0              8s
    204 mariadb-repl-1                                                    2/2     Running           0              3d6h
    205 mariadb-repl-2                                                    2/2     Running           0              3d6h
    206 mariadb-repl-metrics-56865fff65-t72kc                             1/1     Running           0              3d6h
    207 mariadb-repl-physicalbackup-replica-recovery-2025102020270r98zr   0/1     Completed         0              31s
    208 
    209 kubectl get mariadb
    210 NAME           READY   STATUS    PRIMARY          UPDATES                    AGE
    211 mariadb-repl   True    Running   mariadb-repl-1   ReplicasFirstPrimaryLast   3d6h
    212 ```
    213 
    214 #### Documentation
    215 
    216 Please refer to the **[replication docs](https://redirect.github.com/mariadb-operator/mariadb-operator/blob/main/docs/replication.md)** for further details.
    217 
    218 ***
    219 
    220 **`mariadb-operator` needs your support! Please consider contributing by adding yourself to the [list of adopters](https://redirect.github.com/mariadb-operator/mariadb-operator/blob/main/ADOPTERS.md) or starring the project! 🌟**
    221 
    222 #### What's Changed
    223 
    224 - Fix physicalbackup webhook validation by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1489](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1489)
    225 - Enhanced galera recovery by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1491](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1491)
    226 - Add explicit ns in mariadb-cluster chart by [@&#8203;hedgieinsocks](https://redirect.github.com/hedgieinsocks) in [#&#8203;1492](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1492)
    227 - Allow standalone startup and liveness replication probes by [@&#8203;hedgieinsocks](https://redirect.github.com/hedgieinsocks) in [#&#8203;1495](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1495)
    228 - Bump sigs.k8s.io/controller-runtime from 0.21.0 to 0.22.3 by [@&#8203;dependabot](https://redirect.github.com/dependabot)\[bot] in [#&#8203;1472](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1472)
    229 - Update replication docs by [@&#8203;hedgieinsocks](https://redirect.github.com/hedgieinsocks) in [#&#8203;1497](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1497)
    230 - Replication enhancements by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1498](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1498)
    231 
    232 **Full Changelog**: <https://github.com/mariadb-operator/mariadb-operator/compare/25.10.1...25.10.2>
    233 
    234 ### [`v25.10.1`](https://redirect.github.com/mariadb-operator/mariadb-operator/releases/tag/25.10.1)
    235 
    236 [Compare Source](https://redirect.github.com/mariadb-operator/mariadb-operator/compare/mariadb-operator-25.10.0...mariadb-operator-25.10.1)
    237 
    238 > \[!IMPORTANT]\
    239 > There is a regression in this version. Please upgrade to [25.10.2](https://redirect.github.com/mariadb-operator/mariadb-operator/releases/tag/25.10.2) directly.
    240 
    241 **`mariadb-operator` [25.10.1](https://redirect.github.com/mariadb-operator/mariadb-operator/releases/tag/25.10.1) is here!** 🦭
    242 
    243 We are thrilled to announce that our **highly available, replication-based topology is now generally available!** 🎉  It is been quite a journey and we are very excited about this milestone. A huge thank-you to everyone involved, specially for those who actively contributed to the development of this feature, namely [@&#8203;hedgieinsocks](https://redirect.github.com/hedgieinsocks) and [@&#8203;Michaelpalacce](https://redirect.github.com/Michaelpalacce)! 🙇🏼 Please refer to the **[Pull Request for additional details](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1441)** about all the changes introduced in this release.
    244 
    245 If you're upgrading from previous versions, **do not miss the [UPGRADE GUIDE](https://redirect.github.com/mariadb-operator/mariadb-operator/blob/main/docs/releases/UPGRADE_25.10.0.md)** for a smooth transition.
    246 
    247 #### Provisioning a replication cluster
    248 
    249 In order to provision a replication cluster, you need to configure a number of `replicas` greater than `1` and set the `replication.enabled=true` in the `MariaDB` CR:
    250 
    251 ```yaml
    252 apiVersion: k8s.mariadb.com/v1alpha1
    253 kind: MariaDB
    254 metadata:
    255   name: mariadb-repl
    256 spec:
    257   replicas: 3
    258   replication:
    259     enabled: true
    260 ```
    261 
    262 After applying the previous CR, the operator will provision a replication cluster with one primary and two replicas. The operator will take care of setting up replication, configuring the replication user and monitoring the replication status:
    263 
    264 ```bash
    265 kubectl get pods
    266 NAME                                    READY   STATUS    RESTARTS   AGE
    267 mariadb-repl-0                          2/2     Running   0          2d19h
    268 mariadb-repl-1                          2/2     Running   0          2d19h
    269 mariadb-repl-2                          2/2     Running   0          2d19h
    270 mariadb-repl-metrics-56865fff65-t72kc   1/1     Running   0          2d20h
    271 
    272 kubectl get mariadb
    273 NAME           READY   STATUS    PRIMARY          UPDATES                    AGE
    274 mariadb-repl   True    Running   mariadb-repl-0   ReplicasFirstPrimaryLast   2d20h
    275 ```
    276 
    277 As you can see, the primary can be identified in the `PRIMARY` column of the `kubectl get mariadb` output. You may also inspect the current replication status by checking the `MariaDB` status.
    278 
    279 #### Primary failover
    280 
    281 Whenever the primary `Pod` goes down, the operator will automatically trigger a failover to the furthest advanced replica. This is the default behaviour, and can be configured by setting:
    282 
    283 ```yaml
    284 apiVersion: k8s.mariadb.com/v1alpha1
    285 kind: MariaDB
    286 metadata:
    287   name: mariadb-repl
    288 spec:
    289   replicas: 3
    290   replication:
    291     enabled: true
    292     primary:
    293       autoFailover: true
    294       autoFailoverDelay: 0s
    295 ```
    296 
    297 In this situation, the following status will be reported in the `MariaDB` CR:
    298 
    299 ```bash
    300 kubectl get mariadb
    301 NAME           READY   STATUS                                  PRIMARY          UPDATES                    AGE
    302 mariadb-repl   False   Switching primary to 'mariadb-repl-1'   mariadb-repl-0   ReplicasFirstPrimaryLast   3d2h 
    303 
    304 kubectl get mariadb
    305 NAME           READY   STATUS    PRIMARY          UPDATES                    AGE
    306 mariadb-repl   True    Running   mariadb-repl-1   ReplicasFirstPrimaryLast   3d2h
    307 ```
    308 
    309 #### Scaling out
    310 
    311 The operator will scale horizontaly the replication cluster whenever you increase the number of `spec.replicas`. Before doing so, you should specify a template `PhysicalBackup` resource that the operator will use to create the actual `PhysicalBackup` objects to set up new replicas during scaling out events:
    312 
    313 ```yaml
    314 apiVersion: k8s.mariadb.com/v1alpha1
    315 kind: MariaDB
    316 metadata:
    317   name: mariadb-repl
    318 spec:
    319   replication:
    320     enabled: true
    321     replica:
    322       bootstrapFrom:
    323         physicalBackupTemplateRef:
    324           name: physicalbackup-tpl
    325 ---
    326 apiVersion: k8s.mariadb.com/v1alpha1
    327 kind: PhysicalBackup
    328 metadata:
    329   name: physicalbackup-tpl
    330 spec:
    331   mariaDbRef:
    332     name: mariadb-repl
    333   schedule:
    334     suspend: true
    335   storage:
    336     volumeSnapshot:
    337       volumeSnapshotClassName: csi-hostpath-snapclass
    338 ```
    339 
    340 After configuring this, you will be able to scale the cluster simply by:
    341 
    342 ```bash
    343 kubectl scale mariadb mariadb-repl --replicas=4
    344 
    345 kubectl get mariadb
    346 NAME           READY   STATUS        PRIMARY          UPDATES                    AGE
    347 mariadb-repl   False   Scaling out   mariadb-repl-1   ReplicasFirstPrimaryLast   3d5h
    348 
    349 kubectl get pods
    350 NAME                                    READY   STATUS    RESTARTS   AGE
    351 mariadb-repl-0                          2/2     Running   0          137m
    352 mariadb-repl-1                          2/2     Running   0          3d5h
    353 mariadb-repl-2                          2/2     Running   0          3d5h
    354 mariadb-repl-3                          2/2     Running   0          40s
    355 ```
    356 
    357 #### Replica recovery
    358 
    359 The operator has the ability to automatically recover replicas that become unavailable and report a specific error code in the replication status.  For doing so, the operator continiously monitors the replication status of each replica, and whenever they report a known error code, a recovery operation will be triggered.
    360 
    361 Similarly to the scaling out operation, you need to define a `PhysicalBackup` template and set a reference to it in the `spec.replication.replica.bootstrapFrom` field of the `MariaDB` CR. Additionally, you need to explicitly enable the replica recovery, as it is disabled by default:
    362 
    363 ```yaml
    364 apiVersion: k8s.mariadb.com/v1alpha1
    365 kind: MariaDB
    366 metadata:
    367   name: mariadb-repl
    368 spec:
    369   replication:
    370     enabled: true
    371     replica:
    372       bootstrapFrom:
    373         physicalBackupTemplateRef:
    374           name: physicalbackup-tpl
    375       recovery:
    376         enabled: true
    377         errorDurationThreshold: 5m
    378 ```
    379 
    380 We will be simulating a [`1236` error](https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1200-to-1299/e1236) in a replica to demostrate how the recovery process works:
    381 
    382 > \[!CAUTION]
    383 > Do not perform the following steps in a production environment.
    384 
    385 - Purge the binary logs in the primary:
    386 
    387 ```bash
    388 PRIMARY=$(kubectl get mariadb mariadb-repl -o jsonpath="{.status.currentPrimary}")
    389 echo "Purging binary logs in primary $PRIMARY"
    390 kubectl exec -it $PRIMARY -c mariadb -- mariadb -u root -p'MariaDB11!' --ssl=false -e "FLUSH LOGS; PURGE BINARY LOGS BEFORE NOW();"
    391 ```
    392 
    393 - Delete the PVC and restart one of the replicas:
    394 
    395 ```bash
    396 REPLICA=$(kubectl get mariadb mariadb-repl -o jsonpath='{.status.replication.replicas}' | jq -r 'keys[]' | head -n1)
    397 echo "Deleting PVC and restarting replica $REPLICA"
    398 kubectl delete pvc storage-$REPLICA --wait=false 
    399 kubectl delete pod $REPLICA --wait=false 
    400 ```
    401 
    402 This will trigger a replica recovery operation:
    403 
    404 ```bash
    405 kubectl get mariadb
    406 NAME           READY   STATUS                PRIMARY          UPDATES                    AGE
    407 mariadb-repl   False   Recovering replicas   mariadb-repl-1   ReplicasFirstPrimaryLast   3d6h
    408 
    409 kubectl get pods
    410 NAME                                                              READY   STATUS            RESTARTS       AGE
    411 mariadb-repl-0                                                    0/2     PodInitializing   0              22s
    412 mariadb-repl-0-physicalbackup-init-qn79f                          0/1     Completed         0              8s
    413 mariadb-repl-1                                                    2/2     Running           0              3d6h
    414 mariadb-repl-2                                                    2/2     Running           0              3d6h
    415 mariadb-repl-metrics-56865fff65-t72kc                             1/1     Running           0              3d6h
    416 mariadb-repl-physicalbackup-replica-recovery-2025102020270r98zr   0/1     Completed         0              31s
    417 
    418 kubectl get mariadb
    419 NAME           READY   STATUS    PRIMARY          UPDATES                    AGE
    420 mariadb-repl   True    Running   mariadb-repl-1   ReplicasFirstPrimaryLast   3d6h
    421 ```
    422 
    423 #### Documentation
    424 
    425 Please refer to the **[replication docs](https://redirect.github.com/mariadb-operator/mariadb-operator/blob/main/docs/replication.md)** for further details.
    426 
    427 ***
    428 
    429 **`mariadb-operator` needs your support! Please consider contributing by adding yourself to the [list of adopters](https://redirect.github.com/mariadb-operator/mariadb-operator/blob/main/ADOPTERS.md) or starring the project! 🌟**
    430 
    431 **Full Changelog**: <https://github.com/mariadb-operator/mariadb-operator/compare/25.10.0...25.10.1>
    432 
    433 ### [`v25.10.0`](https://redirect.github.com/mariadb-operator/mariadb-operator/releases/tag/25.10.0)
    434 
    435 [Compare Source](https://redirect.github.com/mariadb-operator/mariadb-operator/compare/mariadb-operator-25.8.4...mariadb-operator-25.10.0)
    436 
    437 > \[!IMPORTANT]\
    438 > There is a regression in this version. Please upgrade to [25.10.2](https://redirect.github.com/mariadb-operator/mariadb-operator/releases/tag/25.10.2) directly.
    439 
    440 **`mariadb-operator` [25.10.0](https://redirect.github.com/mariadb-operator/mariadb-operator/releases/tag/25.10.0) is here!** 🦭
    441 
    442 We are thrilled to announce that our **highly available, replication-based topology is now generally available!** 🎉  It is been quite a journey and we are very excited about this milestone. A huge thank-you to everyone involved, specially for those who actively contributed to the development of this feature, namely [@&#8203;hedgieinsocks](https://redirect.github.com/hedgieinsocks) and [@&#8203;Michaelpalacce](https://redirect.github.com/Michaelpalacce)! 🙇🏼 Please refer to the **[Pull Request for additional details](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1441)** about all the changes introduced in this release.
    443 
    444 If you're upgrading from previous versions, **do not miss the [UPGRADE GUIDE](https://redirect.github.com/mariadb-operator/mariadb-operator/blob/main/docs/releases/UPGRADE_25.10.0.md)** for a smooth transition.
    445 
    446 #### Provisioning a replication cluster
    447 
    448 In order to provision a replication cluster, you need to configure a number of `replicas` greater than `1` and set the `replication.enabled=true` in the `MariaDB` CR:
    449 
    450 ```yaml
    451 apiVersion: k8s.mariadb.com/v1alpha1
    452 kind: MariaDB
    453 metadata:
    454   name: mariadb-repl
    455 spec:
    456   replicas: 3
    457   replication:
    458     enabled: true
    459 ```
    460 
    461 After applying the previous CR, the operator will provision a replication cluster with one primary and two replicas. The operator will take care of setting up replication, configuring the replication user and monitoring the replication status:
    462 
    463 ```bash
    464 kubectl get pods
    465 NAME                                    READY   STATUS    RESTARTS   AGE
    466 mariadb-repl-0                          2/2     Running   0          2d19h
    467 mariadb-repl-1                          2/2     Running   0          2d19h
    468 mariadb-repl-2                          2/2     Running   0          2d19h
    469 mariadb-repl-metrics-56865fff65-t72kc   1/1     Running   0          2d20h
    470 
    471 kubectl get mariadb
    472 NAME           READY   STATUS    PRIMARY          UPDATES                    AGE
    473 mariadb-repl   True    Running   mariadb-repl-0   ReplicasFirstPrimaryLast   2d20h
    474 ```
    475 
    476 As you can see, the primary can be identified in the `PRIMARY` column of the `kubectl get mariadb` output. You may also inspect the current replication status by checking the `MariaDB` status.
    477 
    478 #### Primary failover
    479 
    480 Whenever the primary `Pod` goes down, the operator will automatically trigger a failover to the furthest advanced replica. This is the default behaviour, and can be configured by setting:
    481 
    482 ```yaml
    483 apiVersion: k8s.mariadb.com/v1alpha1
    484 kind: MariaDB
    485 metadata:
    486   name: mariadb-repl
    487 spec:
    488   replicas: 3
    489   replication:
    490     enabled: true
    491     primary:
    492       autoFailover: true
    493       autoFailoverDelay: 0s
    494 ```
    495 
    496 In this situation, the following status will be reported in the `MariaDB` CR:
    497 
    498 ```bash
    499 kubectl get mariadb
    500 NAME           READY   STATUS                                  PRIMARY          UPDATES                    AGE
    501 mariadb-repl   False   Switching primary to 'mariadb-repl-1'   mariadb-repl-0   ReplicasFirstPrimaryLast   3d2h 
    502 
    503 kubectl get mariadb
    504 NAME           READY   STATUS    PRIMARY          UPDATES                    AGE
    505 mariadb-repl   True    Running   mariadb-repl-1   ReplicasFirstPrimaryLast   3d2h
    506 ```
    507 
    508 #### Scaling out
    509 
    510 The operator will scale horizontaly the replication cluster whenever you increase the number of `spec.replicas`. Before doing so, you should specify a template `PhysicalBackup` resource that the operator will use to create the actual `PhysicalBackup` objects to set up new replicas during scaling out events:
    511 
    512 ```yaml
    513 apiVersion: k8s.mariadb.com/v1alpha1
    514 kind: MariaDB
    515 metadata:
    516   name: mariadb-repl
    517 spec:
    518   replication:
    519     enabled: true
    520     replica:
    521       bootstrapFrom:
    522         physicalBackupTemplateRef:
    523           name: physicalbackup-tpl
    524 ---
    525 apiVersion: k8s.mariadb.com/v1alpha1
    526 kind: PhysicalBackup
    527 metadata:
    528   name: physicalbackup-tpl
    529 spec:
    530   mariaDbRef:
    531     name: mariadb-repl
    532   schedule:
    533     suspend: true
    534   storage:
    535     volumeSnapshot:
    536       volumeSnapshotClassName: csi-hostpath-snapclass
    537 ```
    538 
    539 After configuring this, you will be able to scale the cluster simply by:
    540 
    541 ```bash
    542 kubectl scale mariadb mariadb-repl --replicas=4
    543 
    544 kubectl get mariadb
    545 NAME           READY   STATUS        PRIMARY          UPDATES                    AGE
    546 mariadb-repl   False   Scaling out   mariadb-repl-1   ReplicasFirstPrimaryLast   3d5h
    547 
    548 kubectl get pods
    549 NAME                                    READY   STATUS    RESTARTS   AGE
    550 mariadb-repl-0                          2/2     Running   0          137m
    551 mariadb-repl-1                          2/2     Running   0          3d5h
    552 mariadb-repl-2                          2/2     Running   0          3d5h
    553 mariadb-repl-3                          2/2     Running   0          40s
    554 ```
    555 
    556 #### Replica recovery
    557 
    558 The operator has the ability to automatically recover replicas that become unavailable and report a specific error code in the replication status.  For doing so, the operator continiously monitors the replication status of each replica, and whenever they report a known error code, a recovery operation will be triggered.
    559 
    560 Similarly to the scaling out operation, you need to define a `PhysicalBackup` template and set a reference to it in the `spec.replication.replica.bootstrapFrom` field of the `MariaDB` CR. Additionally, you need to explicitly enable the replica recovery, as it is disabled by default:
    561 
    562 ```yaml
    563 apiVersion: k8s.mariadb.com/v1alpha1
    564 kind: MariaDB
    565 metadata:
    566   name: mariadb-repl
    567 spec:
    568   replication:
    569     enabled: true
    570     replica:
    571       bootstrapFrom:
    572         physicalBackupTemplateRef:
    573           name: physicalbackup-tpl
    574       recovery:
    575         enabled: true
    576         errorDurationThreshold: 5m
    577 ```
    578 
    579 We will be simulating a [`1236` error](https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1200-to-1299/e1236) in a replica to demostrate how the recovery process works:
    580 
    581 > \[!CAUTION]
    582 > Do not perform the following steps in a production environment.
    583 
    584 - Purge the binary logs in the primary:
    585 
    586 ```bash
    587 PRIMARY=$(kubectl get mariadb mariadb-repl -o jsonpath="{.status.currentPrimary}")
    588 echo "Purging binary logs in primary $PRIMARY"
    589 kubectl exec -it $PRIMARY -c mariadb -- mariadb -u root -p'MariaDB11!' --ssl=false -e "FLUSH LOGS; PURGE BINARY LOGS BEFORE NOW();"
    590 ```
    591 
    592 - Delete the PVC and restart one of the replicas:
    593 
    594 ```bash
    595 REPLICA=$(kubectl get mariadb mariadb-repl -o jsonpath='{.status.replication.replicas}' | jq -r 'keys[]' | head -n1)
    596 echo "Deleting PVC and restarting replica $REPLICA"
    597 kubectl delete pvc storage-$REPLICA --wait=false 
    598 kubectl delete pod $REPLICA --wait=false 
    599 ```
    600 
    601 This will trigger a replica recovery operation:
    602 
    603 ```bash
    604 kubectl get mariadb
    605 NAME           READY   STATUS                PRIMARY          UPDATES                    AGE
    606 mariadb-repl   False   Recovering replicas   mariadb-repl-1   ReplicasFirstPrimaryLast   3d6h
    607 
    608 kubectl get pods
    609 NAME                                                              READY   STATUS            RESTARTS       AGE
    610 mariadb-repl-0                                                    0/2     PodInitializing   0              22s
    611 mariadb-repl-0-physicalbackup-init-qn79f                          0/1     Completed         0              8s
    612 mariadb-repl-1                                                    2/2     Running           0              3d6h
    613 mariadb-repl-2                                                    2/2     Running           0              3d6h
    614 mariadb-repl-metrics-56865fff65-t72kc                             1/1     Running           0              3d6h
    615 mariadb-repl-physicalbackup-replica-recovery-2025102020270r98zr   0/1     Completed         0              31s
    616 
    617 kubectl get mariadb
    618 NAME           READY   STATUS    PRIMARY          UPDATES                    AGE
    619 mariadb-repl   True    Running   mariadb-repl-1   ReplicasFirstPrimaryLast   3d6h
    620 ```
    621 
    622 #### Documentation
    623 
    624 Please refer to the **[replication docs](https://redirect.github.com/mariadb-operator/mariadb-operator/blob/main/docs/replication.md)** for further details.
    625 
    626 ***
    627 
    628 **`mariadb-operator` needs your support! Please consider contributing by adding yourself to the [list of adopters](https://redirect.github.com/mariadb-operator/mariadb-operator/blob/main/ADOPTERS.md) or starring the project! 🌟**
    629 
    630 #### What's Changed
    631 
    632 - Productionize replication provisioning and switchover/failover by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1434](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1434)
    633 - `MaxScale` declarative switchover by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1442](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1442)
    634 - Replication agent by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1444](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1444)
    635 - Replication rolling updates by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1450](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1450)
    636 - Refactor/set defaults by [@&#8203;Michaelpalacce](https://redirect.github.com/Michaelpalacce) in [#&#8203;1449](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1449)
    637 - Replication backups by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1452](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1452)
    638 - Replication scale out by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1461](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1461)
    639 - Tracking replication errors in status by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1466](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1466)
    640 - refactor: Moved `waitPoint` from `spec.replication.replica` to `spec.replication` by [@&#8203;Michaelpalacce](https://redirect.github.com/Michaelpalacce) in [#&#8203;1460](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1460)
    641 - Refactor/remove default connection retries by [@&#8203;Michaelpalacce](https://redirect.github.com/Michaelpalacce) in [#&#8203;1463](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1463)
    642 - feat: replicasAllowEvenNumber will now work only for galera by [@&#8203;Michaelpalacce](https://redirect.github.com/Michaelpalacce) in [#&#8203;1459](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1459)
    643 - Refactor/async replication sync binlog by [@&#8203;Michaelpalacce](https://redirect.github.com/Michaelpalacce) in [#&#8203;1465](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1465)
    644 - Refactor/async repl errgroup by [@&#8203;Michaelpalacce](https://redirect.github.com/Michaelpalacce) in [#&#8203;1455](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1455)
    645 - Refactor/connection timeout move by [@&#8203;Michaelpalacce](https://redirect.github.com/Michaelpalacce) in [#&#8203;1464](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1464)
    646 - Feature/migration script for 25.10.0 by [@&#8203;Michaelpalacce](https://redirect.github.com/Michaelpalacce) in [#&#8203;1467](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1467)
    647 - Test/add restore from physical backup tests by [@&#8203;Michaelpalacce](https://redirect.github.com/Michaelpalacce) in [#&#8203;1471](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1471)
    648 - Replica recovery by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1468](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1468)
    649 - Primary failover by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1478](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1478)
    650 - Support Galera sequences with GTID in Galera recovery process by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1480](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1480)
    651 - Test/add replica recovery integration tests by [@&#8203;Michaelpalacce](https://redirect.github.com/Michaelpalacce) in [#&#8203;1483](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1483)
    652 - Replication docs by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1481](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1481)
    653 - Release 25.10 by [@&#8203;mmontes11](https://redirect.github.com/mmontes11) in [#&#8203;1441](https://redirect.github.com/mariadb-operator/mariadb-operator/pull/1441)
    654 
    655 **Full Changelog**: <https://github.com/mariadb-operator/mariadb-operator/compare/25.8.4...25.10.0>
    656 
    657 ### [`v25.8.4`](https://redirect.github.com/mariadb-operator/mariadb-operator/releases/tag/mariadb-operator-25.8.4)
    658 
    659 [Compare Source](https://redirect.github.com/mariadb-operator/mariadb-operator/compare/mariadb-operator-25.8.3...mariadb-operator-25.8.4)
    660 
    661 Run and operate MariaDB in a cloud native way
    662 
    663 ### [`v25.8.3`](https://redirect.github.com/mariadb-operator/mariadb-operator/releases/tag/mariadb-operator-25.8.3)
    664 
    665 [Compare Source](https://redirect.github.com/mariadb-operator/mariadb-operator/compare/mariadb-operator-25.8.2...mariadb-operator-25.8.3)
    666 
    667 Run and operate MariaDB in a cloud native way
    668 
    669 ### [`v25.8.2`](https://redirect.github.com/mariadb-operator/mariadb-operator/releases/tag/mariadb-operator-25.8.2)
    670 
    671 [Compare Source](https://redirect.github.com/mariadb-operator/mariadb-operator/compare/mariadb-operator-25.8.1...mariadb-operator-25.8.2)
    672 
    673 Run and operate MariaDB in a cloud native way
    674 
    675 ### [`v25.8.1`](https://redirect.github.com/mariadb-operator/mariadb-operator/releases/tag/mariadb-operator-25.8.1)
    676 
    677 [Compare Source](https://redirect.github.com/mariadb-operator/mariadb-operator/compare/mariadb-operator-0.38.1...mariadb-operator-25.8.1)
    678 
    679 Run and operate MariaDB in a cloud native way
    680 
    681 </details>
    682 
    683 ---
    684 
    685 ### Configuration
    686 
    687 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
    688 
    689 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
    690 
    691 ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
    692 
    693 🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
    694 
    695 ---
    696 
    697  - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
    698 
    699 ---
    700 
    701 This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/MTRNord/cluster).
    702 <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4zMi4yIiwidXBkYXRlZEluVmVyIjoiNDIuMzIuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsidHlwZS9tYWpvci11cGRhdGUiXX0=-->
    703 
    704