Storage docs

This commit is contained in:
Martin Montes
2024-02-29 12:24:34 +01:00
parent b6db7edba5
commit b6837fbce1
7 changed files with 132 additions and 2 deletions

View File

@ -240,3 +240,7 @@ make cluster
make install-minio
make net # to access the console via a MetalLB LoadBalancer: https://minio-console:9001
```
## Reference
- [API reference](./API_REFERENCE.md)
- [Example suite](../examples/)

View File

@ -360,3 +360,7 @@ Increase this timeout if you consider that your Galera cluster may take longer t
Here it is a list of GitHub issues reported by `mariadb-operator` users which might shed some light in your investigation:
- https://github.com/mariadb-operator/mariadb-operator/issues?q=is%3Aclosed+label%3Agalera-troubleshoot+
## Reference
- [API reference](./API_REFERENCE.md)
- [Example suite](../examples/)

View File

@ -89,3 +89,7 @@ spec:
operator: "Exists"
effect: "NoSchedule"
```
## Reference
- [API reference](./API_REFERENCE.md)
- [Example suite](../examples/)

View File

@ -96,3 +96,7 @@ To visualize MariaDB metrics, our [Prometheus reference installation](#prometheu
##### [Galera/MariaDB - Overview](https://grafana.com/grafana/dashboards/13106-galera-mariadb-overview/)
## Reference
- [API reference](./API_REFERENCE.md)
- [Example suite](../examples/)

100
docs/STORAGE.md Normal file
View File

@ -0,0 +1,100 @@
# Storage
> [!WARNING]
> This documentation applies to `mariadb-operator` version >= v0.0.26
This operator gives you flexibility to define the storage that will back your `/var/lib/mysql` data directoty mounted by `MariaDB`.
## Configuration
The simplest way to configure storage for your `MariaDB` is:
```yaml
apiVersion: k8s.mariadb.com/v1alpha1
kind: MariaDB
metadata:
name: mariadb-galera
spec:
...
storage:
size: 1Gi
```
This will make use of the default `StorageClass` available in your cluster, but you can also provide a different one:
```yaml
apiVersion: k8s.mariadb.com/v1alpha1
kind: MariaDB
metadata:
name: mariadb-galera
spec:
...
storage:
size: 1Gi
storageClassName: my-storage-class
```
Under the scenes, the operator is configuring the `StatefulSet`'s `volumeClaimTemplate` property, which you are also able to provide yourself:
```yaml
apiVersion: k8s.mariadb.com/v1alpha1
kind: MariaDB
metadata:
name: mariadb-galera
spec:
...
storage:
size: 1Gi
storageClassName: standard
volumeClaimTemplate:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: standard
```
## Volume resize
It is possible to resize your storage after having provisioned a `MariaDB`. We need to distinguish between:
- PVCs already in use.
- `StatefulSet` storage size, which will be used when provisioning new replicas.
It is important to note that, for the first case, your `StorageClass` must support volume expansion by declaring the `allowVolumeExpansion = true`. In such case, it will be safe to expand the storage by increasing the `size` and setting `resizeInUseVolumes = true`:
```yaml
apiVersion: k8s.mariadb.com/v1alpha1
kind: MariaDB
metadata:
name: mariadb-galera
spec:
...
storage:
size: 2Gi
resizeInUseVolumes: true
waitForVolumeResize: true
```
Depending on your storage provider, this operation might take a while, and you can decide to wait for this operation before the `MariaDB` becomes ready by setting `waitForVolumeResize = true`. Operations such as [cluster recovery](./GALERA.md#galera-cluster-recovery) and [primary switchover](./HA.md) will not be performed if the `MariaDB` resource is not ready.
## Ephemeral storage
Provisioning standalone `MariaDB` instances is also possible by setting `ephemeral = true`:
```yaml
apiVersion: k8s.mariadb.com/v1alpha1
kind: MariaDB
metadata:
name: mariadb-galera
spec:
...
storage:
ephemeral: true
```
This may be useful more multiple use cases, like provisioning ephemeral `MariaDBs` for the integration tests of your CI.
## Reference
- [API reference](./API_REFERENCE.md)
- [Example suite](../examples/)

View File

@ -14,6 +14,13 @@ spec:
storageClassName: standard
resizeInUseVolumes: true
waitForVolumeResize: true
volumeClaimTemplate:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: standard
replicas: 3

View File

@ -14,6 +14,13 @@ spec:
storageClassName: standard
resizeInUseVolumes: true
waitForVolumeResize: true
volumeClaimTemplate:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: standard
replicas: 3