DarkflameServer/k8s/mariadb.yml
2024-01-02 12:31:39 +01:00

75 lines
1.3 KiB
YAML

apiVersion: v1
kind: PersistentVolume
metadata:
name: pv0001
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
capacity:
storage: 5Gi
hostPath:
path: /data/pv0001/
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: db-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mariadb-deployment
labels:
app: mariadb
spec:
replicas: 1
selector:
matchLabels:
app: mariadb
template:
metadata:
labels:
app: mariadb
spec:
volumes:
- name: db-pv-storage
persistentVolumeClaim:
claimName: db-pv-claim
containers:
- name: mariadb
image: mariadb:11
ports:
- containerPort: 3306
name: tcp-db-svc
envFrom:
- secretRef:
name: db-secret
prefix: MARIADB_
env:
- name: MARIADB_RANDOM_ROOT_PASSWORD
value: "1"
volumeMounts:
- mountPath: "/var/lib/mysql"
name: db-pv-storage
---
apiVersion: v1
kind: Service
metadata:
name: mariadb-service
spec:
selector:
app: mariadb
ports:
- name: mariadb
protocol: TCP
port: 3306
targetPort: tcp-db-svc