main
ycz 2025-01-02 15:29:51 +08:00
parent 0c50ee483f
commit 2de894e8f6
1 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,69 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mysql-qb
spec:
replicas: 1
serviceName: mysql-qb
selector:
matchLabels:
app: mysql-qb
template:
metadata:
labels:
app: mysql-qb
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-qb
image: mysql:8.0.33
args: ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--max_connections=4000", "--binlog_expire_logs_seconds=432000","--sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"]
ports:
- containerPort: 3306
volumeMounts:
- name: mysql-data-qb
mountPath: /var/lib/mysql
env:
- name: MYSQL_ROOT_PASSWORD
value: "Beaconfire@2099"
volumes:
- name: mysql-data-qb
hostPath:
path: /data/prod/mysql-qb
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "kubernetes.io/hostname"
operator: In
values:
- bfs-k8snode-10-2-2-8.hetzner.base.beaconfireinc.com
---
apiVersion: v1
kind: Service
metadata:
name: mysql-qb
labels:
app: mysql-qb
spec:
ports:
- protocol: TCP
port: 3306
targetPort: 3306
nodePort: 30336
selector:
app: mysql-qb
type: NodePort