OKR/prod-upgrade/nacos/mysql-local.yaml

73 lines
1.9 KiB
YAML
Raw Normal View History

2024-04-11 16:44:47 +08:00
apiVersion: apps/v1
kind: StatefulSet
2023-08-18 11:42:14 +08:00
metadata:
2024-04-11 16:44:47 +08:00
name: mysql-nacos
2023-08-18 11:42:14 +08:00
spec:
replicas: 1
2024-04-11 16:44:47 +08:00
serviceName: mysql-nacos
2023-08-18 11:42:14 +08:00
selector:
2024-04-11 16:44:47 +08:00
matchLabels:
app: mysql-nacos
2023-08-18 11:42:14 +08:00
template:
metadata:
labels:
2024-04-11 16:44:47 +08:00
app: mysql-nacos
2023-08-18 11:42:14 +08:00
spec:
2024-04-11 16:44:47 +08:00
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
2023-08-18 11:42:14 +08:00
containers:
- name: mysql
image: mysql:8.0.33
2024-04-11 16:44:47 +08:00
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"]
2023-08-18 11:42:14 +08:00
ports:
- containerPort: 3306
volumeMounts:
2024-04-11 16:44:47 +08:00
- name: mysql-data
2023-08-18 11:42:14 +08:00
mountPath: /var/lib/mysql
env:
- name: MYSQL_ROOT_PASSWORD
2023-08-18 11:46:04 +08:00
value: "Admin@2099"
2023-08-18 11:42:14 +08:00
- name: MYSQL_DATABASE
value: "nacos"
- name: MYSQL_USER
value: "nacos"
- name: MYSQL_PASSWORD
value: "Nacos@2099"
volumes:
2024-04-11 16:44:47 +08:00
- name: mysql-data
2023-08-18 11:42:14 +08:00
hostPath:
path: /data/nacos/mysql
2024-04-11 16:44:47 +08:00
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "kubernetes.io/hostname"
operator: In
values:
- bfs-k8snode-10-2-2-8.hetzner.base.beaconfireinc.com
2023-08-18 11:42:14 +08:00
---
apiVersion: v1
kind: Service
metadata:
2024-04-11 16:44:47 +08:00
name: mysql-nacos
2023-08-18 11:42:14 +08:00
labels:
2024-04-11 17:47:04 +08:00
app: mysql-nacos
2023-08-18 11:42:14 +08:00
spec:
ports:
- port: 3306
targetPort: 3306
selector:
2024-04-11 17:47:04 +08:00
app: mysql-nacos