From a25d25ab7621bba4f058394408ac57e5ac2a8ee4 Mon Sep 17 00:00:00 2001 From: ycz008 Date: Thu, 11 Apr 2024 16:44:47 +0800 Subject: [PATCH] update prod nacos --- prod-upgrade/nacos/mysql-local.yaml | 48 ++++++++++++++++++++-------- prod-upgrade/nacos/nacos-no-pvc.yaml | 2 +- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/prod-upgrade/nacos/mysql-local.yaml b/prod-upgrade/nacos/mysql-local.yaml index 025167d..880b916 100644 --- a/prod-upgrade/nacos/mysql-local.yaml +++ b/prod-upgrade/nacos/mysql-local.yaml @@ -1,26 +1,39 @@ -apiVersion: v1 -kind: ReplicationController +apiVersion: apps/v1 +kind: StatefulSet metadata: - name: mysql - labels: - name: mysql + name: mysql-nacos spec: replicas: 1 + serviceName: mysql-nacos selector: - name: mysql + matchLabels: + app: mysql-nacos template: metadata: labels: - name: mysql + app: mysql-nacos 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"] + 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: nacos-mysql-data + - name: mysql-data mountPath: /var/lib/mysql env: - name: MYSQL_ROOT_PASSWORD @@ -32,19 +45,28 @@ spec: - name: MYSQL_PASSWORD value: "Nacos@2099" volumes: - - name: nacos-mysql-data + - name: mysql-data hostPath: 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 kind: Service metadata: - name: mysql + name: mysql-nacos labels: - name: mysql + name: mysql-nacos spec: ports: - port: 3306 targetPort: 3306 selector: - name: mysql + name: mysql-nacos diff --git a/prod-upgrade/nacos/nacos-no-pvc.yaml b/prod-upgrade/nacos/nacos-no-pvc.yaml index 9a88ceb..73d60af 100644 --- a/prod-upgrade/nacos/nacos-no-pvc.yaml +++ b/prod-upgrade/nacos/nacos-no-pvc.yaml @@ -42,7 +42,7 @@ kind: ConfigMap metadata: name: nacos-cm data: - mysql.host: "mysql" + mysql.host: "mysql-nacos.base.svc" mysql.db.name: "nacos" mysql.port: "3306" mysql.user: "root"