64 lines
1.4 KiB
YAML
64 lines
1.4 KiB
YAML
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: mariadb-statefulset
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: mariadb
|
|
serviceName: mariadb
|
|
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
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: mariadb-pvc
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 20Gi
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: mariadb
|
|
labels:
|
|
app: mariadb
|
|
spec:
|
|
selector:
|
|
app: mariadb
|
|
ports:
|
|
- name: mariadb
|
|
port: 3306
|