39 lines
861 B
YAML
39 lines
861 B
YAML
|
apiVersion: apps/v1
|
||
|
kind: StatefulSet
|
||
|
metadata:
|
||
|
name: mysql
|
||
|
spec:
|
||
|
serviceName: mysql-service
|
||
|
replicas: 1
|
||
|
selector:
|
||
|
matchLabels:
|
||
|
app: mysql
|
||
|
template:
|
||
|
metadata:
|
||
|
labels:
|
||
|
app: mysql
|
||
|
spec:
|
||
|
containers:
|
||
|
- name: mysql
|
||
|
image: rafasaez/sql-app
|
||
|
ports:
|
||
|
- containerPort: 3306
|
||
|
env:
|
||
|
- name: MYSQL_ROOT_PASSWORD
|
||
|
valueFrom:
|
||
|
secretKeyRef:
|
||
|
name: mysql-secret
|
||
|
key: password
|
||
|
volumeMounts:
|
||
|
- name: mysql-persistent-storage
|
||
|
mountPath: /var/lib/mysql
|
||
|
#Crea los pv necerarios
|
||
|
volumeClaimTemplates:
|
||
|
- metadata:
|
||
|
name: mysql-persistent-storage
|
||
|
spec:
|
||
|
accessModes: [ "ReadWriteOnce" ]
|
||
|
resources:
|
||
|
requests:
|
||
|
storage: 1Gi
|
||
|
|