89 lines
2.3 KiB
YAML
89 lines
2.3 KiB
YAML
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: db
|
|
namespace: epcare
|
|
spec:
|
|
selector:
|
|
app: db
|
|
ports:
|
|
- name: mysql
|
|
protocol: TCP
|
|
port: 3306
|
|
targetPort: 3306
|
|
clusterIP: None # Headless — stable DNS for OpenMRS without load balancing
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: db
|
|
namespace: epcare
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: db
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: db
|
|
spec:
|
|
nodeSelector:
|
|
kubernetes.io/hostname: NODE_HOSTNAME
|
|
# Fix: chown /var/lib/mysql to mysql user (999) at pod start
|
|
securityContext:
|
|
fsGroup: 999
|
|
initContainers:
|
|
- name: fix-permissions
|
|
image: busybox
|
|
command: ["sh", "-c", "chown -R 999:999 /var/lib/mysql"]
|
|
volumeMounts:
|
|
- name: db-data
|
|
mountPath: /var/lib/mysql
|
|
imagePullSecrets:
|
|
- name: gitlab-registry
|
|
containers:
|
|
- name: db
|
|
image: harbour.control-1.test.signalytic.dev/epcare/mysql/arm64:1.0
|
|
imagePullPolicy: IfNotPresent
|
|
args:
|
|
- --character-set-server=utf8mb4
|
|
- --collation-server=utf8mb4_general_ci
|
|
envFrom:
|
|
- secretRef:
|
|
name: db-env
|
|
ports:
|
|
- containerPort: 3306
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- 'mysqladmin ping -h localhost -u${MYSQL_USER} -p${MYSQL_PASSWORD}'
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
failureThreshold: 20
|
|
volumeMounts:
|
|
- name: db-data
|
|
mountPath: /var/lib/mysql
|
|
- name: mysql-config
|
|
mountPath: /etc/mysql/conf.d/mysql.cnf
|
|
subPath: mysql.cnf
|
|
readOnly: true
|
|
- name: db-dumps
|
|
mountPath: /docker-entrypoint-initdb.d
|
|
readOnly: true
|
|
volumes:
|
|
- name: db-data
|
|
persistentVolumeClaim:
|
|
claimName: db-data-pvc
|
|
- name: mysql-config
|
|
configMap:
|
|
name: mysql-config
|
|
- name: db-dumps
|
|
hostPath:
|
|
path: /opt/epcare/resources/db/dumps
|
|
type: DirectoryOrCreate
|