mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
Add mariadb persistence (#97)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
name: mariadb
|
||||
version: 0.3.1
|
||||
version: 0.4.0
|
||||
description: Chart for MariaDB
|
||||
keywords:
|
||||
- mariadb
|
||||
|
||||
@@ -60,6 +60,10 @@ The following tables lists the configurable parameters of the MariaDB chart and
|
||||
| `mariadbUser` | Username of new user to create. | `nil` |
|
||||
| `mariadbPassword` | Password for the new user. | `nil` |
|
||||
| `mariadbDatabase` | Name for new database to create. | `nil` |
|
||||
| `persistence.enabled` | Use a PVC to persist data | `true` |
|
||||
| `persistence.storageClass` | Storage class of backing PVC | `generic` |
|
||||
| `persistence.accessMode` | Use volume as ReadOnly or ReadWrite | `ReadWriteOnce` |
|
||||
| `persistence.size` | Size of data volume | `8Gi` |
|
||||
|
||||
The above parameters map to the env variables defined in [bitnami/mariadb](http://github.com/bitnami/bitnami-docker-mariadb). For more information please refer to the [bitnami/mariadb](http://github.com/bitnami/bitnami-docker-mariadb) image documentation.
|
||||
|
||||
@@ -85,38 +89,4 @@ $ helm install --name my-release -f values.yaml mariadb-x.x.x.tgz
|
||||
|
||||
The [Bitnami MariaDB](https://github.com/bitnami/bitnami-docker-mariadb) image stores the MariaDB data and configurations at the `/bitnami/mariadb` path of the container.
|
||||
|
||||
As a placeholder, the chart mounts an [emptyDir](http://kubernetes.io/docs/user-guide/volumes/#emptydir) volume at this location.
|
||||
|
||||
> *"An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever."*
|
||||
|
||||
For persistence of the data you should replace the `emptyDir` volume with a persistent [storage volume](http://kubernetes.io/docs/user-guide/volumes/), else the data will be lost if the Pod is shutdown.
|
||||
|
||||
### Step 1: Create a persistent disk
|
||||
|
||||
You first need to create a persistent disk in the cloud platform your cluster is running. For example, on GCE you can use the `gcloud` tool to create a [gcePersistentDisk](http://kubernetes.io/docs/user-guide/volumes/#gcepersistentdisk):
|
||||
|
||||
```bash
|
||||
$ gcloud compute disks create --size=500GB --zone=us-central1-a mariadb-data-disk
|
||||
```
|
||||
|
||||
### Step 2: Update `templates/deployment.yaml`
|
||||
|
||||
Replace:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
- name: data
|
||||
emptyDir: {}
|
||||
```
|
||||
|
||||
with
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
- name: data
|
||||
gcePersistentDisk:
|
||||
pdName: mariadb-data-disk
|
||||
fsType: ext4
|
||||
```
|
||||
|
||||
[Install](#installing-the-chart) the chart after making these changes.
|
||||
The chart mounts a [Persistent Volume](kubernetes.io/docs/user-guide/persistent-volumes/) volume at this location. The volume is created using dynamic volume provisioning.
|
||||
|
||||
@@ -57,4 +57,9 @@ spec:
|
||||
mountPath: /bitnami/mariadb
|
||||
volumes:
|
||||
- name: data
|
||||
{{- if .Values.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ template "fullname" . }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end -}}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{{- if .Values.persistence.enabled }}
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
annotations:
|
||||
volume.alpha.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- end }}
|
||||
@@ -25,3 +25,10 @@ image: bitnami/mariadb:10.1.17-r1
|
||||
## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-on-first-run
|
||||
##
|
||||
# mariadbDatabase:
|
||||
|
||||
## Persist data to a persitent volume
|
||||
persistence:
|
||||
enabled: true
|
||||
storageClass: generic
|
||||
accessMode: ReadWriteOnce
|
||||
size: 8Gi
|
||||
|
||||
Reference in New Issue
Block a user