2020-05-01 22:08:35 +00:00
|
|
|
apiVersion: apps/v1
|
2020-05-07 00:05:40 +00:00
|
|
|
kind: StatefulSet
|
2020-05-01 22:08:35 +00:00
|
|
|
metadata:
|
2020-05-18 20:18:39 +00:00
|
|
|
name: mariadb
|
2020-05-01 22:08:35 +00:00
|
|
|
spec:
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: mariadb
|
2020-05-07 00:05:40 +00:00
|
|
|
serviceName: mariadb
|
2020-05-01 22:08:35 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: mariadb
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- name: mariadb
|
|
|
|
image: mariadb:10.5.2
|
|
|
|
env:
|
|
|
|
- name: MYSQL_DATABASE
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: mariadb-credentials-secret
|
|
|
|
key: database
|
|
|
|
- name: MYSQL_USER
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: mariadb-credentials-secret
|
|
|
|
key: username
|
|
|
|
- name: MYSQL_PASSWORD
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: mariadb-credentials-secret
|
|
|
|
key: password
|
|
|
|
- name: MYSQL_RANDOM_ROOT_PASSWORD
|
|
|
|
value: "yes"
|
|
|
|
ports:
|
|
|
|
- name: mariadb
|
|
|
|
containerPort: 3306
|
|
|
|
volumeMounts:
|
|
|
|
- name: mariadb-pvc
|
|
|
|
mountPath: /var/lib/mysql
|
2020-05-07 00:05:40 +00:00
|
|
|
volumeClaimTemplates:
|
|
|
|
- metadata:
|
|
|
|
name: mariadb-pvc
|
|
|
|
spec:
|
|
|
|
accessModes:
|
|
|
|
- ReadWriteOnce
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: 20Gi
|
2020-05-01 22:08:35 +00:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: mariadb
|
|
|
|
labels:
|
|
|
|
app: mariadb
|
|
|
|
spec:
|
|
|
|
selector:
|
|
|
|
app: mariadb
|
|
|
|
ports:
|
|
|
|
- name: mariadb
|
2020-05-02 01:55:34 +00:00
|
|
|
port: 3306
|