78 lines
1.7 KiB
YAML
78 lines
1.7 KiB
YAML
|
# Headless service for stable DNS entries of StatefulSet members.
|
||
|
apiVersion: v1
|
||
|
kind: Service
|
||
|
metadata:
|
||
|
name: mysql
|
||
|
namespace: invoiceninja
|
||
|
spec:
|
||
|
ports:
|
||
|
- name: mysql
|
||
|
port: 3306
|
||
|
clusterIP: None
|
||
|
selector:
|
||
|
app: mysql
|
||
|
---
|
||
|
apiVersion: apps/v1
|
||
|
kind: StatefulSet
|
||
|
metadata:
|
||
|
name: mysql
|
||
|
namespace: invoiceninja
|
||
|
spec:
|
||
|
selector:
|
||
|
matchLabels:
|
||
|
app: mysql
|
||
|
app.kubernetes.io/name: mysql
|
||
|
serviceName: mysql
|
||
|
replicas: 1
|
||
|
template:
|
||
|
metadata:
|
||
|
labels:
|
||
|
app: mysql
|
||
|
app.kubernetes.io/name: mysql
|
||
|
spec:
|
||
|
containers:
|
||
|
- name: mysql
|
||
|
image: mysql:8
|
||
|
envFrom:
|
||
|
- secretRef:
|
||
|
name: mysql
|
||
|
env:
|
||
|
- name: MYSQL_ALLOW_EMPTY_PASSWORD
|
||
|
value: "1"
|
||
|
- name: MYSQL_USER
|
||
|
value: ninja
|
||
|
- name: MYSQL_DATABASE
|
||
|
value: ninja
|
||
|
ports:
|
||
|
- name: mysql
|
||
|
containerPort: 3306
|
||
|
volumeMounts:
|
||
|
- name: data
|
||
|
mountPath: /var/lib/mysql
|
||
|
subPath: mysql
|
||
|
resources:
|
||
|
requests:
|
||
|
cpu: 500m
|
||
|
memory: 1Gi
|
||
|
livenessProbe:
|
||
|
exec:
|
||
|
command: ["mysqladmin", "ping"]
|
||
|
initialDelaySeconds: 30
|
||
|
periodSeconds: 10
|
||
|
timeoutSeconds: 5
|
||
|
readinessProbe:
|
||
|
exec:
|
||
|
# Check we can execute queries over TCP (skip-networking is off).
|
||
|
command: ["mysql", "-h", "127.0.0.1", "-e", "SELECT 1"]
|
||
|
initialDelaySeconds: 5
|
||
|
periodSeconds: 2
|
||
|
timeoutSeconds: 1
|
||
|
volumeClaimTemplates:
|
||
|
- metadata:
|
||
|
name: data
|
||
|
spec:
|
||
|
accessModes: ["ReadWriteOnce"]
|
||
|
resources:
|
||
|
requests:
|
||
|
storage: 10Gi
|