64 lines
1.3 KiB
YAML
64 lines
1.3 KiB
YAML
# PostgreSQL StatefulSet
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: mysql
|
|
namespace: suhailahamed
|
|
spec:
|
|
serviceName: mysql-service
|
|
selector:
|
|
matchLabels:
|
|
app: mysql
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: mysql
|
|
spec:
|
|
containers:
|
|
- name: mysql
|
|
image: mysql:8.0
|
|
imagePullPolicy: 'IfNotPresent'
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /var/lib/mysql
|
|
env:
|
|
- name: MYSQL_DATABASE
|
|
value: 'main'
|
|
- name: MYSQL_USER
|
|
value: 'user'
|
|
- name: MYSQL_PASSWORD
|
|
value: 'password'
|
|
- name: MYSQL_ROOT_PASSWORD
|
|
value: 'root1'
|
|
|
|
ports:
|
|
- name: mysql
|
|
containerPort: 3306
|
|
protocol: TCP
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: data
|
|
namespace: suhailahamed
|
|
spec:
|
|
storageClassName: ''
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 5Gi
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: PersistentVolume
|
|
metadata:
|
|
name: pv-volume
|
|
labels:
|
|
type: local
|
|
spec:
|
|
storageClassName: ''
|
|
capacity:
|
|
storage: 5Gi
|
|
accessModes: ['ReadWriteOnce']
|
|
hostPath:
|
|
path: '/mnt/pg'
|