mirror of
https://github.com/bitnami/charts.git
synced 2026-03-16 06:47:30 +08:00
Add database replication for MySQL
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
name: mysql
|
||||
version: 0.1.14
|
||||
version: 1.0.0
|
||||
appVersion: 5.7.22
|
||||
description: MySQL is a fast, reliable, scalable, and easy to use open-source relational database system. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software.
|
||||
description: Chart to create a Highly available MySQL cluster
|
||||
keywords:
|
||||
- mysql
|
||||
- database
|
||||
- sql
|
||||
- cluster
|
||||
- high availablity
|
||||
home: https://mysql.com
|
||||
icon: https://bitnami.com/assets/stacks/mysql/img/mysql-stack-220x234.png
|
||||
sources:
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
# MySQL
|
||||
|
||||
[MySQL](https://mysql.com ) MySQL is a fast, reliable, scalable, and easy to use open-source relational database system. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software.
|
||||
[MySQL](https://mysql.com) is a fast, reliable, scalable, and easy to use open-source relational database system. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software.
|
||||
|
||||
|
||||
## TL;DR;
|
||||
## TL;DR
|
||||
|
||||
```bash
|
||||
$ helm install bitnami/mysql
|
||||
@@ -11,7 +10,7 @@ $ helm install bitnami/mysql
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart bootstraps a [MySQL](https://github.com/bitnami/bitnami-docker-mysql) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
|
||||
This chart bootstraps a [MySQL](https://github.com/bitnami/bitnami-docker-mysql) replication cluster deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@@ -44,23 +43,68 @@ The command removes all the Kubernetes components associated with the chart and
|
||||
|
||||
The following tables lists the configurable parameters of the MySQL chart and their default values.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|----------------------------|--------------------------------------------|-----------------------------------------------------------|
|
||||
| `image.registry` | MySQL image registry | `docker.io` |
|
||||
| `image.repository` | MySQL Image name | `bitnami/mysql` |
|
||||
| `image.tag` | MySQL Image tag | `{VERSION}` |
|
||||
| `image.pullPolicy` | MySQL image pull policy | `Always` if `imageTag` is `latest`, else `IfNotPresent` |
|
||||
| `image.pullSecrets` | Specify image pull secrets | `nil` (does not add image pull secrets to deployed pods) |
|
||||
| `mysqlRootPassword` | Password for the `root` user. | `nil` |
|
||||
| `mysqlUser` | Username of new user to create. | `nil` |
|
||||
| `mysqlPassword` | Password for the new user. | `nil` |
|
||||
| `mysqlDatabase` | Name for new database to create. | `nil` |
|
||||
| `persistence.enabled` | Use a PVC to persist data | `true` |
|
||||
| `persistence.storageClass` | Storage class of backing PVC | `nil` (uses alpha storage class annotation) |
|
||||
| `persistence.accessMode` | Use volume as ReadOnly or ReadWrite | `ReadWriteOnce` |
|
||||
| `persistence.size` | Size of data volume | `8Gi` |
|
||||
| `resources` | CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `250m` |
|
||||
| `config` | Multi-line string for my.cnf configuration | `nil` |
|
||||
| Parameter | Description | Default |
|
||||
|-------------------------------------------|-----------------------------------------------------|-------------------------------------------------------------------|
|
||||
| `image.registry` | MySQL image registry | `docker.io` |
|
||||
| `image.repository` | MySQL Image name | `bitnami/mysql` |
|
||||
| `image.tag` | MySQL Image tag | `{VERSION}` |
|
||||
| `image.pullPolicy` | MySQL image pull policy | `Always` if `imageTag` is `latest`, else `IfNotPresent` |
|
||||
| `image.pullSecrets` | Specify image pull secrets | `nil` (does not add image pull secrets to deployed pods) |
|
||||
| `service.type` | Kubernetes service type | `ClusterIP` |
|
||||
| `service.port` | MySQL service port | `3306` |
|
||||
| `root.password` | Password for the `root` user | _random 10 character alphanumeric string_ |
|
||||
| `db.user` | Username of new user to create | `nil` |
|
||||
| `db.password` | Password for the new user | _random 10 character alphanumeric string if `db.user` is defined_ |
|
||||
| `db.name` | Name for new database to create | `my_database` |
|
||||
| `replication.enabled` | MySQL replication enabled | `true` |
|
||||
| `replication.user` | MySQL replication user | `replicator` |
|
||||
| `replication.password` | MySQL replication user password | _random 10 character alphanumeric string_ |
|
||||
| `master.antiAffinity` | Master pod anti-affinity policy | `soft` |
|
||||
| `master.persistence.enabled` | Enable persistence using a `PersistentVolumeClaim` | `true` |
|
||||
| `master.persistence.annotations` | Persistent Volume Claim annotations | `{}` |
|
||||
| `master.persistence.storageClass` | Persistent Volume Storage Class | `` |
|
||||
| `master.persistence.accessModes` | Persistent Volume Access Modes | `[ReadWriteOnce]` |
|
||||
| `master.persistence.size` | Persistent Volume Size | `8Gi` |
|
||||
| `master.config` | Config file for the MySQL Master server | `_default values in the values.yaml file_` |
|
||||
| `master.resources` | CPU/Memory resource requests/limits for master node | `{}` |
|
||||
| `master.livenessProbe.enabled` | Turn on and off liveness probe (master) | `true` |
|
||||
| `master.livenessProbe.initialDelaySeconds`| Delay before liveness probe is initiated (master) | `120` |
|
||||
| `master.livenessProbe.periodSeconds` | How often to perform the probe (master) | `10` |
|
||||
| `master.livenessProbe.timeoutSeconds` | When the probe times out (master) | `1` |
|
||||
| `master.livenessProbe.successThreshold` | Minimum consecutive successes for the probe (master)| `1` |
|
||||
| `master.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe (master) | `3` |
|
||||
| `master.readinessProbe.enabled` | Turn on and off readiness probe (master) | `true` |
|
||||
| `master.readinessProbe.initialDelaySeconds`| Delay before readiness probe is initiated (master) | `15` |
|
||||
| `master.readinessProbe.periodSeconds` | How often to perform the probe (master) | `10` |
|
||||
| `master.readinessProbe.timeoutSeconds` | When the probe times out (master) | `1` |
|
||||
| `master.readinessProbe.successThreshold` | Minimum consecutive successes for the probe (master)| `1` |
|
||||
| `master.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe (master) | `3` |
|
||||
| `slave.replicas` | Desired number of slave replicas | `1` |
|
||||
| `slave.antiAffinity` | Slave pod anti-affinity policy | `soft` |
|
||||
| `slave.persistence.enabled` | Enable persistence using a `PersistentVolumeClaim` | `true` |
|
||||
| `slave.persistence.annotations` | Persistent Volume Claim annotations | `{}` |
|
||||
| `slave.persistence.storageClass` | Persistent Volume Storage Class | `` |
|
||||
| `slave.persistence.accessModes` | Persistent Volume Access Modes | `[ReadWriteOnce]` |
|
||||
| `slave.persistence.size` | Persistent Volume Size | `8Gi` |
|
||||
| `slave.config` | Config file for the MySQL Slave replicas | `_default values in the values.yaml file_` |
|
||||
| `slave.resources` | CPU/Memory resource requests/limits for slave node | `{}` |
|
||||
| `slave.livenessProbe.enabled` | Turn on and off liveness probe (slave) | `true` |
|
||||
| `slave.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated (slave) | `120` |
|
||||
| `slave.livenessProbe.periodSeconds` | How often to perform the probe (slave) | `10` |
|
||||
| `slave.livenessProbe.timeoutSeconds` | When the probe times out (slave) | `1` |
|
||||
| `slave.livenessProbe.successThreshold` | Minimum consecutive successes for the probe (slave) | `1` |
|
||||
| `slave.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe (slave) | `3` |
|
||||
| `slave.readinessProbe.enabled` | Turn on and off readiness probe (slave) | `true` |
|
||||
| `slave.readinessProbe.initialDelaySeconds`| Delay before readiness probe is initiated (slave) | `15` |
|
||||
| `slave.readinessProbe.periodSeconds` | How often to perform the probe (slave) | `10` |
|
||||
| `slave.readinessProbe.timeoutSeconds` | When the probe times out (slave) | `1` |
|
||||
| `slave.readinessProbe.successThreshold` | Minimum consecutive successes for the probe (slave) | `1` |
|
||||
| `slave.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe (slave) | `3` |
|
||||
| `metrics.enabled` | Start a side-car prometheus exporter | `false` |
|
||||
| `metrics.image` | Exporter image name | `prom/mysqld-exporter` |
|
||||
| `metrics.imageTag` | Exporter image tag | `v0.10.0` |
|
||||
| `metrics.imagePullPolicy` | Exporter image pull policy | `IfNotPresent` |
|
||||
| `metrics.resources` | Exporter resource requests/limit | `nil` |
|
||||
|
||||
The above parameters map to the env variables defined in [bitnami/mysql](http://github.com/bitnami/bitnami-docker-mysql). For more information please refer to the [bitnami/mysql](http://github.com/bitnami/bitnami-docker-mysql) image documentation.
|
||||
|
||||
@@ -68,11 +112,11 @@ Specify each parameter using the `--set key=value[,key=value]` argument to `helm
|
||||
|
||||
```bash
|
||||
$ helm install --name my-release \
|
||||
--set mysqlRootPassword=secretpassword,mysqlUser=my-user,mysqlPassword=my-password,mysqlDatabase=my-database \
|
||||
--set root.password=secretpassword,user.database=app_database \
|
||||
bitnami/mysql
|
||||
```
|
||||
|
||||
The above command sets the MySQL `root` account password to `secretpassword`. Additionally it creates a standard database user named `my-user`, with the password `my-password`, who has access to a database named `my-database`.
|
||||
The above command sets the MySQL `root` account password to `secretpassword`. Additionally it creates a database named `my_database`.
|
||||
|
||||
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
|
||||
|
||||
@@ -82,30 +126,8 @@ $ helm install --name my-release -f values.yaml bitnami/mysql
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||
|
||||
### Custom my.cnf configuration
|
||||
|
||||
The Bitnami MySQL image allows you to provide a custom `my.cnf` file for configuring MySQL.
|
||||
This Chart uses the `config` value to mount a custom `my.cnf` using a [ConfigMap](http://kubernetes.io/docs/user-guide/configmap/).
|
||||
You can configure this by creating a YAML file that defines the `config` property as a multi-line string in the format of a `my.cnf` file.
|
||||
For example:
|
||||
|
||||
```bash
|
||||
cat > mysql-values.yaml <<EOF
|
||||
config: |-
|
||||
[mysqld]
|
||||
max_allowed_packet = 64M
|
||||
sql_mode=STRICT_ALL_TABLES
|
||||
ft_stopword_file=/etc/mysql/stopwords.txt
|
||||
ft_min_word_len=3
|
||||
ft_boolean_syntax=' |-><()~*:""&^'
|
||||
innodb_buffer_pool_size=2G
|
||||
EOF
|
||||
|
||||
helm install --name my-release -f mysql-values.yaml bitnami/mysql
|
||||
```
|
||||
|
||||
## Persistence
|
||||
|
||||
The [Bitnami MySQL](https://github.com/bitnami/bitnami-docker-mysql) image stores the MySQL data and configurations at the `/bitnami/mysql` path of the container.
|
||||
|
||||
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.
|
||||
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, by default. An existing PersistentVolumeClaim can be defined.
|
||||
|
||||
@@ -1,11 +1,35 @@
|
||||
MySQL can be accessed via port 3306 on the following DNS name from within your cluster:
|
||||
{{ template "fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
|
||||
|
||||
To connect to your database:
|
||||
Please be patient while the chart is being deployed
|
||||
|
||||
1. Run a pod that you can use as a client:
|
||||
Tip:
|
||||
|
||||
kubectl run {{ template "fullname" . }}-client --rm --tty -i --image bitnami/mysql --command -- bash
|
||||
Watch the deployment status using the command: kubectl get pods -w --namespace {{ .Release.Namespace }}
|
||||
|
||||
2. Connect using the mysql cli, then provide your password:
|
||||
$ mysql -h {{ template "fullname" . }} {{- if .Values.mysqlRootPassword }} -p {{ .Values.mysqlRootPassword }}{{- end -}}
|
||||
Services:
|
||||
|
||||
echo Master: {{ template "master.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }}
|
||||
{{- if .Values.replication.enabled }}
|
||||
echo Slave: {{ template "slave.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }}
|
||||
{{- end }}
|
||||
|
||||
Administrator credentials:
|
||||
|
||||
echo Username: root
|
||||
echo Password : $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.mysql-root-password}" | base64 --decode)
|
||||
|
||||
To connect to your database
|
||||
|
||||
1. Run a pod that you can use as a client:
|
||||
|
||||
kubectl run {{ template "fullname" . }}-client --rm --tty -i --image {{ template "mysql.image" . }} --namespace {{ .Release.Namespace }} --command -- bash
|
||||
|
||||
2. To connect to master service (read/write):
|
||||
|
||||
mysql -h {{ template "master.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local -uroot -p {{ .Values.db.name }}
|
||||
|
||||
{{- if .Values.replication.enabled }}
|
||||
|
||||
3. To connect to slave service (read-only):
|
||||
|
||||
mysql -h {{ template "slave.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local -uroot -p {{ .Values.db.name }}
|
||||
{{- end }}
|
||||
|
||||
@@ -14,3 +14,33 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "master.fullname" -}}
|
||||
{{- printf "%s-%s" .Release.Name "mysql-master" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "slave.fullname" -}}
|
||||
{{- printf "%s-%s" .Release.Name "mysql-slave" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mysql.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper MySQL image name
|
||||
*/}}
|
||||
{{- define "mysql.image" -}}
|
||||
{{- $registryName := default "docker.io" .Values.image.registry -}}
|
||||
{{- $tag := default "latest" .Values.image.tag -}}
|
||||
{{- printf "%s/%s:%s" $registryName .Values.image.repository $tag -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper MySQL metrics exporter image name
|
||||
*/}}
|
||||
{{- define "metrics.image" -}}
|
||||
{{- $registryName := default "docker.io" .Values.metrics.image.registry -}}
|
||||
{{- $tag := default "latest" .Values.metrics.image.tag -}}
|
||||
{{- printf "%s/%s:%s" $registryName .Values.metrics.image.repository $tag -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
app: {{ template "fullname" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
data:
|
||||
my.cnf: |-
|
||||
{{- if .Values.config }}
|
||||
{{ .Values.config | indent 4 }}
|
||||
{{- end -}}
|
||||
@@ -1,102 +0,0 @@
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
app: {{ template "fullname" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "fullname" . }}
|
||||
annotations:
|
||||
pod.alpha.kubernetes.io/init-containers: '
|
||||
[
|
||||
{
|
||||
"name": "copy-custom-config",
|
||||
"image": "{{ .Values.image }}",
|
||||
"imagePullPolicy": {{ .Values.imagePullPolicy | quote }},
|
||||
"command": ["sh", "-c", "mkdir -p /bitnami/mysql/conf && cp -n /bitnami/mysql_config/my.cnf /bitnami/mysql/conf/my_custom.cnf"],
|
||||
"volumeMounts": [
|
||||
{
|
||||
"name": "config",
|
||||
"mountPath": "/bitnami/mysql_config"
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"mountPath": "/bitnami/mysql"
|
||||
}
|
||||
]
|
||||
}
|
||||
]'
|
||||
spec:
|
||||
{{- if .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ template "fullname" . }}
|
||||
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||
env:
|
||||
- name: MYSQL_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "fullname" . }}
|
||||
key: mysql-root-password
|
||||
- name: MYSQL_USER
|
||||
value: {{ default "" .Values.mysqlUser | quote }}
|
||||
- name: MYSQL_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "fullname" . }}
|
||||
key: mysql-password
|
||||
- name: MYSQL_DATABASE
|
||||
value: {{ default "" .Values.mysqlDatabase | quote }}
|
||||
- name: ALLOW_EMPTY_PASSWORD
|
||||
value: "yes"
|
||||
- name: POD_IP
|
||||
valueFrom: { fieldRef: { fieldPath: status.podIP } }
|
||||
ports:
|
||||
- name: mysql
|
||||
containerPort: 3306
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- exec mysqladmin --host $POD_IP ping
|
||||
initialDelaySeconds: 120
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 10
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- exec mysqladmin --host $POD_IP ping
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 1
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 10 }}
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /bitnami/mysql
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ template "fullname" . }}
|
||||
- name: data
|
||||
{{- if .Values.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ template "fullname" . }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end -}}
|
||||
@@ -1,23 +0,0 @@
|
||||
{{- if .Values.persistence.enabled }}
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
app: {{ template "fullname" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
annotations:
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }}
|
||||
{{- else }}
|
||||
volume.alpha.kubernetes.io/storage-class: default
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- end }}
|
||||
@@ -1,13 +1,38 @@
|
||||
{{- if (not .Values.root.existingSecret) -}}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
app: {{ template "fullname" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
app: "{{ template "name" . }}"
|
||||
chart: {{ template "mysql.chart" . }}
|
||||
release: {{ .Release.Name | quote }}
|
||||
heritage: {{ .Release.Service | quote }}
|
||||
type: Opaque
|
||||
data:
|
||||
mysql-root-password: {{ default "" .Values.mysqlRootPassword | b64enc | quote }}
|
||||
mysql-password: {{ default "" .Values.mysqlPassword | b64enc | quote }}
|
||||
{{- if .Values.root.password }}
|
||||
mysql-root-password: "{{ .Values.root.password | b64enc }}"
|
||||
{{- else if (not .Values.root.forcePassword) }}
|
||||
mysql-root-password: "{{ randAlphaNum 10 | b64enc }}"
|
||||
{{ else }}
|
||||
mysql-root-password: {{ required "A MySQL Root Password is required!" .Values.root.password }}
|
||||
{{- end }}
|
||||
{{- if .Values.db.user }}
|
||||
{{- if .Values.db.password }}
|
||||
mysql-password: "{{ .Values.db.password | b64enc }}"
|
||||
{{- else if (not .Values.db.forcePassword) }}
|
||||
mysql-password: "{{ randAlphaNum 10 | b64enc }}"
|
||||
{{- else }}
|
||||
mysql-password: {{ required "A MySQL Database Password is required!" .Values.db.password }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.replication.enabled }}
|
||||
{{- if .Values.replication.password }}
|
||||
mysql-replication-password: "{{ .Values.replication.password | b64enc }}"
|
||||
{{- else if (not .Values.replication.forcePassword) }}
|
||||
mysql-replication-password: "{{ randAlphaNum 10 | b64enc }}"
|
||||
{{- else }}
|
||||
mysql-replication-password: {{ required "A MySQL Replication Password is required!" .Values.replication.password }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -1,16 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
app: {{ template "fullname" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
spec:
|
||||
ports:
|
||||
- name: mysql
|
||||
port: 3306
|
||||
targetPort: mysql
|
||||
selector:
|
||||
app: {{ template "fullname" . }}
|
||||
@@ -1,7 +1,6 @@
|
||||
## Bitnami MySQL image version
|
||||
## Bitnami MySQL image
|
||||
## ref: https://hub.docker.com/r/bitnami/mysql/tags/
|
||||
##
|
||||
## Default: none
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/mysql
|
||||
@@ -10,58 +9,225 @@ image:
|
||||
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||
##
|
||||
pullPolicy: IfNotPresent
|
||||
pullPolicy: Always
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistrKeySecretName
|
||||
# - myRegistrKeySecretName
|
||||
|
||||
## Specify an imagePullPolicy (Required)
|
||||
## It's recommended to change this to 'Always' if the image tag is 'latest'
|
||||
## ref: http://kubernetes.io/docs/user-guide/images/#updating-images
|
||||
imagePullPolicy: IfNotPresent
|
||||
service:
|
||||
## Kubernetes service type
|
||||
type: ClusterIP
|
||||
port: 3306
|
||||
|
||||
## Specify password for root user
|
||||
## ref: https://github.com/bitnami/bitnami-docker-mysql/blob/master/README.md#setting-the-root-password-on-first-run
|
||||
##
|
||||
# mysqlRootPassword:
|
||||
|
||||
## Create a database user
|
||||
## ref: https://github.com/bitnami/bitnami-docker-mysql/blob/master/README.md#creating-a-database-user-on-first-run
|
||||
##
|
||||
# mysqlUser:
|
||||
# mysqlPassword:
|
||||
|
||||
## Create a database
|
||||
## ref: https://github.com/bitnami/bitnami-docker-mysql/blob/master/README.md#creating-a-database-on-first-run
|
||||
##
|
||||
# mysqlDatabase:
|
||||
|
||||
## Enable persistence using Persistent Volume Claims
|
||||
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
|
||||
##
|
||||
persistence:
|
||||
enabled: true
|
||||
## If defined, volume.beta.kubernetes.io/storage-class: <storageClass>
|
||||
## Default: volume.alpha.kubernetes.io/storage-class: default
|
||||
root:
|
||||
## MySQL admin password
|
||||
## ref: https://github.com/bitnami/bitnami-docker-mysql#setting-the-root-password-on-first-run
|
||||
##
|
||||
# storageClass:
|
||||
accessMode: ReadWriteOnce
|
||||
size: 8Gi
|
||||
password:
|
||||
## Use existing secret (ignores root, db and replication passwords)
|
||||
# existingSecret:
|
||||
##
|
||||
## Option to force users to specify a password. That is required for 'helm upgrade' to work properly.
|
||||
## If it is not force, a random password will be generated.
|
||||
forcePassword: false
|
||||
|
||||
db:
|
||||
## MySQL username and password
|
||||
## ref: https://github.com/bitnami/bitnami-docker-mysql#creating-a-database-user-on-first-run
|
||||
##
|
||||
user:
|
||||
password:
|
||||
## Password is ignored if existingSecret is specified.
|
||||
## Database to create
|
||||
## ref: https://github.com/bitnami/bitnami-docker-mysql#creating-a-database-on-first-run
|
||||
##
|
||||
name: my_database
|
||||
## Option to force users to specify a password. That is required for 'helm upgrade' to work properly.
|
||||
## If it is not force, a random password will be generated.
|
||||
forcePassword: false
|
||||
|
||||
## Configure MySQL with a custom my.cnf file
|
||||
## ref: https://mysql.com/kb/en/mysql/configuring-mysql-with-mycnf/#example-of-configuration-file
|
||||
##
|
||||
# config: |-
|
||||
# [mysqld]
|
||||
# innodb_buffer_pool_size=2G
|
||||
replication:
|
||||
## Enable replication. This enables the creation of replicas of MySQL. If false, only a
|
||||
## master deployment would be created
|
||||
enabled: true
|
||||
##
|
||||
## MySQL replication user
|
||||
## ref: https://github.com/bitnami/bitnami-docker-mysql#setting-up-a-replication-cluster
|
||||
##
|
||||
user: replicator
|
||||
## MySQL replication user password
|
||||
## ref: https://github.com/bitnami/bitnami-docker-mysql#setting-up-a-replication-cluster
|
||||
##
|
||||
password:
|
||||
## Password is ignored if existingSecret is specified.
|
||||
##
|
||||
## Option to force users to specify a password. That is required for 'helm upgrade' to work properly.
|
||||
## If it is not force, a random password will be generated.
|
||||
forcePassword: false
|
||||
|
||||
## Configure resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
resources:
|
||||
requests:
|
||||
memory: 256Mi
|
||||
cpu: 250m
|
||||
master:
|
||||
antiAffinity: soft
|
||||
## Enable persistence using Persistent Volume Claims
|
||||
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
|
||||
##
|
||||
persistence:
|
||||
## If true, use a Persistent Volume Claim, If false, use emptyDir
|
||||
##
|
||||
enabled: true
|
||||
## Persistent Volume Storage Class
|
||||
## If defined, storageClassName: <storageClass>
|
||||
## If set to "-", storageClassName: "", which disables dynamic provisioning
|
||||
## If undefined (the default) or set to null, no storageClassName spec is
|
||||
## set, choosing the default provisioner. (gp2 on AWS, standard on
|
||||
## GKE, AWS & OpenStack)
|
||||
##
|
||||
# storageClass: "-"
|
||||
## Persistent Volume Claim annotations
|
||||
##
|
||||
annotations:
|
||||
## Persistent Volume Access Mode
|
||||
##
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
## Persistent Volume size
|
||||
##
|
||||
size: 8Gi
|
||||
##
|
||||
|
||||
## Configure MySQL with a custom my.cnf file
|
||||
## ref: https://mysql.com/kb/en/mysql/configuring-mysql-with-mycnf/#example-of-configuration-file
|
||||
##
|
||||
config: |-
|
||||
[mysqld]
|
||||
skip-name-resolve
|
||||
explicit_defaults_for_timestamp
|
||||
basedir=/opt/bitnami/mysql
|
||||
port=3306
|
||||
socket=/opt/bitnami/mysql/tmp/mysql.sock
|
||||
tmpdir=/opt/bitnami/mysql/tmp
|
||||
max_allowed_packet=16M
|
||||
bind-address=0.0.0.0
|
||||
pid-file=/opt/bitnami/mysql/tmp/mysqld.pid
|
||||
log-error=/opt/bitnami/mysql/logs/mysqld.log
|
||||
character-set-server=UTF8
|
||||
collation-server=utf8_general_ci
|
||||
|
||||
[client]
|
||||
port=3306
|
||||
socket=/opt/bitnami/mysql/tmp/mysql.sock
|
||||
default-character-set=UTF8
|
||||
|
||||
[manager]
|
||||
port=3306
|
||||
socket=/opt/bitnami/mysql/tmp/mysql.sock
|
||||
pid-file=/opt/bitnami/mysql/tmp/mysqld.pid
|
||||
|
||||
## Configure master resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
resources: {}
|
||||
livenessProbe:
|
||||
enabled: true
|
||||
##
|
||||
## Initializing the database could take some time
|
||||
initialDelaySeconds: 120
|
||||
##
|
||||
## Default Kubernetes values
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 1
|
||||
successThreshold: 1
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 15
|
||||
##
|
||||
## Default Kubernetes values
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 1
|
||||
successThreshold: 1
|
||||
failureThreshold: 3
|
||||
|
||||
slave:
|
||||
replicas: 1
|
||||
antiAffinity: soft
|
||||
persistence:
|
||||
## If true, use a Persistent Volume Claim, If false, use emptyDir
|
||||
##
|
||||
enabled: true
|
||||
# storageClass: "-"
|
||||
annotations:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
## Persistent Volume size
|
||||
##
|
||||
size: 8Gi
|
||||
##
|
||||
|
||||
## Configure MySQL slave with a custom my.cnf file
|
||||
## ref: https://mysql.com/kb/en/mysql/configuring-mysql-with-mycnf/#example-of-configuration-file
|
||||
##
|
||||
config: |-
|
||||
[mysqld]
|
||||
skip-name-resolve
|
||||
explicit_defaults_for_timestamp
|
||||
basedir=/opt/bitnami/mysql
|
||||
port=3306
|
||||
socket=/opt/bitnami/mysql/tmp/mysql.sock
|
||||
tmpdir=/opt/bitnami/mysql/tmp
|
||||
max_allowed_packet=16M
|
||||
bind-address=0.0.0.0
|
||||
pid-file=/opt/bitnami/mysql/tmp/mysqld.pid
|
||||
log-error=/opt/bitnami/mysql/logs/mysqld.log
|
||||
character-set-server=UTF8
|
||||
collation-server=utf8_general_ci
|
||||
|
||||
[client]
|
||||
port=3306
|
||||
socket=/opt/bitnami/mysql/tmp/mysql.sock
|
||||
default-character-set=UTF8
|
||||
|
||||
[manager]
|
||||
port=3306
|
||||
socket=/opt/bitnami/mysql/tmp/mysql.sock
|
||||
pid-file=/opt/bitnami/mysql/tmp/mysqld.pid
|
||||
|
||||
##
|
||||
## Configure slave resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
resources: {}
|
||||
livenessProbe:
|
||||
enabled: true
|
||||
##
|
||||
## Initializing the database could take some time
|
||||
initialDelaySeconds: 120
|
||||
##
|
||||
## Default Kubernetes values
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 1
|
||||
successThreshold: 1
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 15
|
||||
##
|
||||
## Default Kubernetes values
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 1
|
||||
successThreshold: 1
|
||||
failureThreshold: 3
|
||||
|
||||
metrics:
|
||||
enabled: false
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: prom/mysqld-exporter
|
||||
tag: v0.10.0
|
||||
pullPolicy: IfNotPresent
|
||||
resources: {}
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "9104"
|
||||
|
||||
Reference in New Issue
Block a user