53 lines
1.1 KiB
YAML
53 lines
1.1 KiB
YAML
apiVersion: v1
|
|
kind: PersistentVolume
|
|
metadata:
|
|
name: my-pv
|
|
spec:
|
|
capacity:
|
|
storage: 1Gi
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
persistentVolumeReclaimPolicy: Retain
|
|
storageClassName: slow
|
|
hostPath:
|
|
path: /data/my-pv/
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: mysql
|
|
namespace: ibanweb
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: mysql
|
|
serviceName: mysql
|
|
replicas: 1
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: mysql
|
|
spec:
|
|
containers:
|
|
- name: mysql
|
|
image: mysql:latest
|
|
env:
|
|
- name: MYSQL_ROOT_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mysql-secret
|
|
key: password
|
|
ports:
|
|
- containerPort: 3306
|
|
name: mysql
|
|
volumeMounts:
|
|
- name: mysql-persistent-storage
|
|
mountPath: /var/lib/mysql
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: mysql-persistent-storage
|
|
spec:
|
|
accessModes: [ "ReadWriteOnce" ]
|
|
resources:
|
|
requests:
|
|
storage: 1Gi |