72 lines
1.5 KiB
YAML
72 lines
1.5 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: mariadb-deployment
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: mariadb
|
|
strategy:
|
|
type: Recreate
|
|
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
|
|
volumes:
|
|
- name: mariadb-pvc
|
|
persistentVolumeClaim:
|
|
claimName: mariadb-pvc
|
|
---
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: mariadb-pvc
|
|
labels:
|
|
app: mariadb
|
|
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 |