update prod nacos

main
ycz008 2024-04-11 16:44:47 +08:00
parent 34e04bc497
commit a25d25ab76
2 changed files with 36 additions and 14 deletions

View File

@ -1,26 +1,39 @@
apiVersion: v1 apiVersion: apps/v1
kind: ReplicationController kind: StatefulSet
metadata: metadata:
name: mysql name: mysql-nacos
labels:
name: mysql
spec: spec:
replicas: 1 replicas: 1
serviceName: mysql-nacos
selector: selector:
name: mysql matchLabels:
app: mysql-nacos
template: template:
metadata: metadata:
labels: labels:
name: mysql app: mysql-nacos
spec: 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: containers:
- name: mysql - name: mysql
image: mysql:8.0.33 image: mysql:8.0.33
args: ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--max_connections=2000", "--binlog_expire_logs_seconds=432000"] 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: ports:
- containerPort: 3306 - containerPort: 3306
volumeMounts: volumeMounts:
- name: nacos-mysql-data - name: mysql-data
mountPath: /var/lib/mysql mountPath: /var/lib/mysql
env: env:
- name: MYSQL_ROOT_PASSWORD - name: MYSQL_ROOT_PASSWORD
@ -32,19 +45,28 @@ spec:
- name: MYSQL_PASSWORD - name: MYSQL_PASSWORD
value: "Nacos@2099" value: "Nacos@2099"
volumes: volumes:
- name: nacos-mysql-data - name: mysql-data
hostPath: hostPath:
path: /data/nacos/mysql path: /data/nacos/mysql
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "kubernetes.io/hostname"
operator: In
values:
- bfs-k8snode-10-2-2-8.hetzner.base.beaconfireinc.com
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: mysql name: mysql-nacos
labels: labels:
name: mysql name: mysql-nacos
spec: spec:
ports: ports:
- port: 3306 - port: 3306
targetPort: 3306 targetPort: 3306
selector: selector:
name: mysql name: mysql-nacos

View File

@ -42,7 +42,7 @@ kind: ConfigMap
metadata: metadata:
name: nacos-cm name: nacos-cm
data: data:
mysql.host: "mysql" mysql.host: "mysql-nacos.base.svc"
mysql.db.name: "nacos" mysql.db.name: "nacos"
mysql.port: "3306" mysql.port: "3306"
mysql.user: "root" mysql.user: "root"