103 lines
2.1 KiB
YAML
103 lines
2.1 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: mysql
|
|
namespace: database
|
|
labels:
|
|
app: mysql
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: mysql
|
|
strategy:
|
|
type: Recreate
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: mysql
|
|
spec:
|
|
containers:
|
|
- name: mysql
|
|
image: mysql:8.4
|
|
ports:
|
|
- containerPort: 3306
|
|
name: mysql
|
|
envFrom:
|
|
- secretRef:
|
|
name: mysql-secret
|
|
volumeMounts:
|
|
- name: mysql-data
|
|
mountPath: /var/lib/mysql
|
|
- name: mysql-init
|
|
mountPath: /docker-entrypoint-initdb.d
|
|
resources:
|
|
requests:
|
|
memory: "512Mi"
|
|
cpu: "250m"
|
|
limits:
|
|
memory: "1Gi"
|
|
cpu: "500m"
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- mysqladmin
|
|
- ping
|
|
- -h
|
|
- localhost
|
|
- -u
|
|
- root
|
|
- -prootpassword
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- mysqladmin
|
|
- ping
|
|
- -h
|
|
- localhost
|
|
- -u
|
|
- root
|
|
- -prootpassword
|
|
initialDelaySeconds: 60
|
|
periodSeconds: 20
|
|
timeoutSeconds: 5
|
|
volumes:
|
|
- name: mysql-data
|
|
persistentVolumeClaim:
|
|
claimName: mysql-pvc
|
|
- name: mysql-init
|
|
configMap:
|
|
name: mysql-init-db
|
|
---
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: mysql-pvc
|
|
namespace: database
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 5Gi
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: mysql
|
|
namespace: database
|
|
labels:
|
|
app: mysql
|
|
spec:
|
|
type: ClusterIP
|
|
ports:
|
|
- port: 3306
|
|
targetPort: 3306
|
|
protocol: TCP
|
|
name: mysql
|
|
selector:
|
|
app: mysql
|