OKR/tob-upgrade/mysql/mysql.yaml

76 lines
1.9 KiB
YAML

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mysql
spec:
replicas: 1
serviceName: mysql
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
initContainers:
- name: init
image: busybox
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- |
sysctl -w net.ipv4.tcp_keepalive_time=300
sysctl -w net.ipv4.tcp_keepalive_intvl=10
sysctl -w net.ipv4.tcp_keepalive_probes=3
securityContext:
privileged: true
containers:
- name: mysql
image: mysql:8.0.33
args: ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--max_connections=2000", "--binlog_expire_logs_seconds=432000","--sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"]
ports:
- containerPort: 3306
volumeMounts:
- name: tcs-mysql
mountPath: /var/lib/mysql
env:
- name: MYSQL_ROOT_PASSWORD
value: "Beaconfire@2099"
- name: MYSQL_DATABASE
value: "test"
- name: MYSQL_USER
value: "app"
- name: MYSQL_PASSWORD
value: "beaconfire@123"
volumes:
- name: tcs-mysql
hostPath:
path: /data/tcs/mysql
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "kubernetes.io/hostname"
operator: In
values:
- bfs-k8snode-10-2-3-7.hetzner.base.beaconfireinc.com
---
apiVersion: v1
kind: Service
metadata:
name: mysql
labels:
app: mysql
spec:
ports:
- protocol: TCP
port: 3306
targetPort: 3306
nodePort: 30016
selector:
app: mysql
type: NodePort