196 lines
5.1 KiB
YAML
196 lines
5.1 KiB
YAML
|
apiVersion: v1
|
||
|
kind: ServiceAccount
|
||
|
metadata:
|
||
|
name: paradoxfox-mariadb
|
||
|
namespace: paradoxfox
|
||
|
labels:
|
||
|
app.kubernetes.io/name: mariadb
|
||
|
app.kubernetes.io/instance: paradoxfox
|
||
|
automountServiceAccountToken: false
|
||
|
|
||
|
---
|
||
|
|
||
|
apiVersion: v1
|
||
|
kind: Secret
|
||
|
metadata:
|
||
|
name: paradoxfox-mariadb
|
||
|
namespace: paradoxfox
|
||
|
labels:
|
||
|
app.kubernetes.io/name: mariadb
|
||
|
app.kubernetes.io/instance: paradoxfox
|
||
|
annotations:
|
||
|
kube-1password: mo3bsobixz4dsy5jlwfkadjprm
|
||
|
kube-1password/vault: Kubernetes
|
||
|
kube-1password/secret-text-parse: "true"
|
||
|
type: Opaque
|
||
|
|
||
|
---
|
||
|
|
||
|
apiVersion: v1
|
||
|
kind: ConfigMap
|
||
|
metadata:
|
||
|
name: paradoxfox-mariadb
|
||
|
namespace: paradoxfox
|
||
|
labels:
|
||
|
app.kubernetes.io/name: mariadb
|
||
|
app.kubernetes.io/instance: paradoxfox
|
||
|
app.kubernetes.io/component: primary
|
||
|
data:
|
||
|
my.cnf: |-
|
||
|
[mysqld]
|
||
|
skip-name-resolve
|
||
|
explicit_defaults_for_timestamp
|
||
|
basedir=/opt/bitnami/mariadb
|
||
|
plugin_dir=/opt/bitnami/mariadb/plugin
|
||
|
port=3306
|
||
|
socket=/opt/bitnami/mariadb/tmp/mysql.sock
|
||
|
tmpdir=/opt/bitnami/mariadb/tmp
|
||
|
max_allowed_packet=16M
|
||
|
bind-address=*
|
||
|
pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
|
||
|
log-error=/opt/bitnami/mariadb/logs/mysqld.log
|
||
|
character-set-server=UTF8
|
||
|
collation-server=utf8_general_ci
|
||
|
slow_query_log=0
|
||
|
slow_query_log_file=/opt/bitnami/mariadb/logs/mysqld.log
|
||
|
long_query_time=10.0
|
||
|
|
||
|
[client]
|
||
|
port=3306
|
||
|
socket=/opt/bitnami/mariadb/tmp/mysql.sock
|
||
|
default-character-set=UTF8
|
||
|
plugin_dir=/opt/bitnami/mariadb/plugin
|
||
|
|
||
|
[manager]
|
||
|
port=3306
|
||
|
socket=/opt/bitnami/mariadb/tmp/mysql.sock
|
||
|
pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
|
||
|
|
||
|
---
|
||
|
|
||
|
apiVersion: v1
|
||
|
kind: Service
|
||
|
metadata:
|
||
|
name: paradoxfox-mariadb
|
||
|
namespace: paradoxfox
|
||
|
labels:
|
||
|
app.kubernetes.io/name: mariadb
|
||
|
app.kubernetes.io/instance: paradoxfox
|
||
|
app.kubernetes.io/component: primary
|
||
|
annotations:
|
||
|
spec:
|
||
|
type: ClusterIP
|
||
|
sessionAffinity: None
|
||
|
ports:
|
||
|
- name: mysql
|
||
|
port: 3306
|
||
|
protocol: TCP
|
||
|
targetPort: mysql
|
||
|
selector:
|
||
|
app.kubernetes.io/name: mariadb
|
||
|
app.kubernetes.io/instance: paradoxfox
|
||
|
app.kubernetes.io/component: primary
|
||
|
|
||
|
---
|
||
|
|
||
|
apiVersion: apps/v1
|
||
|
kind: StatefulSet
|
||
|
metadata:
|
||
|
name: paradoxfox-mariadb
|
||
|
namespace: paradoxfox
|
||
|
labels:
|
||
|
app.kubernetes.io/name: mariadb
|
||
|
app.kubernetes.io/instance: paradoxfox
|
||
|
app.kubernetes.io/component: primary
|
||
|
spec:
|
||
|
replicas: 1
|
||
|
selector:
|
||
|
matchLabels:
|
||
|
app.kubernetes.io/name: mariadb
|
||
|
app.kubernetes.io/instance: paradoxfox
|
||
|
app.kubernetes.io/component: primary
|
||
|
serviceName: paradoxfox-mariadb
|
||
|
updateStrategy:
|
||
|
type: RollingUpdate
|
||
|
template:
|
||
|
metadata:
|
||
|
labels:
|
||
|
app.kubernetes.io/name: mariadb
|
||
|
app.kubernetes.io/instance: paradoxfox
|
||
|
app.kubernetes.io/component: primary
|
||
|
spec:
|
||
|
serviceAccountName: paradoxfox-mariadb
|
||
|
securityContext:
|
||
|
fsGroup: 1001
|
||
|
containers:
|
||
|
- name: mariadb
|
||
|
image: docker.io/bitnami/mariadb:10.6.9-debian-11-r0
|
||
|
imagePullPolicy: "IfNotPresent"
|
||
|
securityContext:
|
||
|
runAsNonRoot: true
|
||
|
runAsUser: 1001
|
||
|
envFrom:
|
||
|
- secretRef:
|
||
|
name: paradoxfox-mariadb
|
||
|
ports:
|
||
|
- name: mysql
|
||
|
containerPort: 3306
|
||
|
livenessProbe:
|
||
|
failureThreshold: 3
|
||
|
initialDelaySeconds: 120
|
||
|
periodSeconds: 10
|
||
|
successThreshold: 1
|
||
|
timeoutSeconds: 1
|
||
|
exec:
|
||
|
command:
|
||
|
- /bin/bash
|
||
|
- -ec
|
||
|
- |
|
||
|
password_aux="${MARIADB_ROOT_PASSWORD:-}"
|
||
|
if [[ -f "${MARIADB_ROOT_PASSWORD_FILE:-}" ]]; then
|
||
|
password_aux=$(cat "$MARIADB_ROOT_PASSWORD_FILE")
|
||
|
fi
|
||
|
mysqladmin status -uroot -p"${password_aux}"
|
||
|
readinessProbe:
|
||
|
failureThreshold: 3
|
||
|
initialDelaySeconds: 30
|
||
|
periodSeconds: 10
|
||
|
successThreshold: 1
|
||
|
timeoutSeconds: 1
|
||
|
exec:
|
||
|
command:
|
||
|
- /bin/bash
|
||
|
- -ec
|
||
|
- |
|
||
|
password_aux="${MARIADB_ROOT_PASSWORD:-}"
|
||
|
if [[ -f "${MARIADB_ROOT_PASSWORD_FILE:-}" ]]; then
|
||
|
password_aux=$(cat "$MARIADB_ROOT_PASSWORD_FILE")
|
||
|
fi
|
||
|
mysqladmin status -uroot -p"${password_aux}"
|
||
|
resources:
|
||
|
limits: {}
|
||
|
requests: {}
|
||
|
volumeMounts:
|
||
|
- name: data
|
||
|
mountPath: /bitnami/mariadb
|
||
|
- name: config
|
||
|
mountPath: /opt/bitnami/mariadb/conf/my.cnf
|
||
|
subPath: my.cnf
|
||
|
volumes:
|
||
|
- name: config
|
||
|
configMap:
|
||
|
name: paradoxfox-mariadb
|
||
|
volumeClaimTemplates:
|
||
|
- metadata:
|
||
|
name: data
|
||
|
labels:
|
||
|
app.kubernetes.io/name: mariadb
|
||
|
app.kubernetes.io/instance: paradoxfox
|
||
|
app.kubernetes.io/component: primary
|
||
|
spec:
|
||
|
accessModes:
|
||
|
- "ReadWriteOnce"
|
||
|
resources:
|
||
|
requests:
|
||
|
storage: "8Gi"
|